Tuesday, January 20, 2015

DOS : long file names

There are times when long file names are a pain.

I had a batch file that called a file inside a directory and the directory had spaces in the name e.g.

c:\a long name\another long name\program.exe

And it wouldn't damn well find it. Kept getting error messages like "File x ...".

I used "" and everything else I could think of.

Then from a long-distant past, I remembered DOS and the command

dir /x

This displays the short names generated for non-8dot3 file names.

So e.g. C:\Program Files\Resource Kit becomes C:\PROGRA~1\RESOUR~1

Putting the short name in the batch file solved the problem.

Go figure.


No comments: