Author Topic: Help with Dos Short/long File Name  (Read 7249 times)

mrhaboobi

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Help with Dos Short/long File Name
« on: October 10, 2006, 09:52:51 pm »
HI guys,

im using slickedits default build commands to set up some commands to build my project.  one of the commands i use is %rw to get the current project folder path, this returns the long filename format, but my tool requires short names.  Is there any thing i can do to get the short file names?

eg i have c:\somelongfilenamehere\ and i want

c:\somelo~1\

Any help would be great.. like i said this is used with the build options under my project menus.

Graeme

  • Senior Community Member
  • Posts: 2366
  • Hero Points: 313
Re: Help with Dos Short/long File Name
« Reply #1 on: October 11, 2006, 11:17:02 pm »
HI guys,

im using slickedits default build commands to set up some commands to build my project.  one of the commands i use is %rw to get the current project folder path, this returns the long filename format, but my tool requires short names.  Is there any thing i can do to get the short file names?

eg i have c:\somelongfilenamehere\ and i want

c:\somelo~1\

Any help would be great.. like i said this is used with the build options under my project menus.


Instead of calling the tool directly, you can call a batch file that calls the tool for you.  The batch file can convert long filenames to short ones using %~s

e.g. create a batch file (say bt.bat) with this

echo %~s1
pause


then call it like bt.bat  c:/abc/somelongname.txt
and you'll see it output the short version.

Graeme

mrhaboobi

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
Re: Help with Dos Short/long File Name
« Reply #2 on: October 15, 2006, 10:03:56 pm »
Hi Graeme

Thanks for the tip, unfortunately this doesnt seem to work, even just using your simple example returns the long file name and not the short version.. :(  any more thoughts..

Graeme

  • Senior Community Member
  • Posts: 2366
  • Hero Points: 313
Re: Help with Dos Short/long File Name
« Reply #3 on: October 15, 2006, 10:26:50 pm »

Which operating system are you using?  Check the help info on batch files that your OS provides and see if %~s is described there.  There's also a Win32 API function GetShortPathName that can be used to get the short name - you could probably write a small win32 app that converted to short names and called a particular tool.

Graeme


hs2

  • Senior Community Member
  • Posts: 2738
  • Hero Points: 288
Re: Help with Dos Short/long File Name
« Reply #4 on: October 15, 2006, 10:29:09 pm »
Or have a look here: http://www.jsifaq.com/SF/Tips/Tip.aspx?id=8518
Quote
I have scripted CvtLFNSFN.bat to convert a LFN (Long File Name) to a SFN (Short File Name).
HS2