1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Short File Name Won't Execute

Discussion in 'Support' started by Jay Sage, Dec 15, 2014.

  1. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    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?
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    Do you have "Search for SFNs" turned off? It's on the first page of the OPTION dialog.
     
  3. Jay Sage

    Joined:
    Jun 2, 2008
    Messages:
    284
    Likes Received:
    1
    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.
     
  4. mikea

    Joined:
    Dec 7, 2009
    Messages:
    211
    Likes Received:
    2
    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?
     
  5. Christian Albaret

    Joined:
    Jul 1, 2008
    Messages:
    154
    Likes Received:
    1
    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.
     

Share This Page