Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Short File Name Won't Execute

Jun
552
4
I have the environment variable ".pdf" defined to be "reader", which invokes Adobe Reader. If I enter a long file name that ends with ".pdf" as a command on the command line, the file opens in Reader. However, if I enter the short file name,

C:\Users\Jay\DOCUME~1\JG157F~1.PDF​

I get an error message that the command is not recognized. Is this an expected limitation of short file names with executable extensions?
 
Do you have "Search for SFNs" turned off? It's on the first page of the OPTION dialog.
 
Do you have "Search for SFNs" turned off?

Thanks. I'm sure that's it (it is). And I don't think I want to change that setting.

What's interesting is that short directory names are processed; it seems to be only files that are not found using the short name.

As you might guess, this is all related to my attempts to mitigate the horrendous practice of using spaces in directory and file names. My initial solution was to automatically add quotes around files and directories with spaces, but problems occur when trying to make changes, such as adding a file name to the end of a directory name enclosed in quotes. So I thought it was clever to just use the short file names. Back to the drawing board.

In my script to put a directory path into the clipboard, I'm leaving the conversion to the short name, but I'll leave file names alone.
 
However, if I enter the short file name,

C:\Users\Jay\DOCUME~1\JG157F~1.PDF​

I get an error message that the command is not recognized. Is this an expected limitation of short file names with executable extensions?
I have run across problems with filenames containing spaces so often that I've gotten into the habit of using "start /pgm" to launch many programs. I wonder: in defining the executable extension, can you precede the name of the executable with "start /pgm" -- would that help?
 
I see (and discover) the same behavior:
- it doesn't work as the verb, it doesn't work with DIR ("Search for SFN" checked or not),
- it works with START/PGM, it works as an argument to a PDF-viewer, it even works as an argument to an unrelated program (e.g. my text editor will correctly open it and display the long filename) (both my PDF-viewer and my editor are 32 bit executables).

Concerning the issue of “adding a file name to the end of a directory name enclosed in quotes”, the @full function seems to do the job now.
 

Similar threads

Back
Top