Long File & Path Names Shorten When Launched Using Association

Last reviewed: January 10, 1996
Article ID: Q142275
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) for

        - Microsoft Windows NT version 3.51
        - Microsoft Windows 95 version 4.0
    

SYMPTOMS

When an application is installed along a path that contains a space (as in C:\Program Files\MyApp) and you double-click a data file registered to MyApp.exe in Explorer (or any other shell), you will only get a short file name on the command line.

RESOLUTION

To resolve the problem, place quotation marks around the around the arguments list in the registry entries, as in this example:

 HKEY_CLASSES_ROOT\MyApp\Shell\Open\Command =
   <path to MyApp.exe> "%1"

Without the quotation marks, short names are the result. With quotation marks, long file names are the result. This works correctly in Windows 95 and Windows NT 3.51.

STATUS

This behavior is by design.

MORE INFORMATION

The 8.3 file name specification didn't allow spaces in filenames, so the system automatically converts long file names to short filenames when no quotation marks are used to differenciate between a long file name and a list of short names seperated by spaces.

Basically the shell looks at the .exe type of the program refered to, if it is a win32 .exe, the shell passes a long name by default (as %1), if it is not, the shell passes the short name. The code that sniffs the .exe type requires the quotation marks to get this right.


Additional reference words: 4.00
KBCategory: kbenv kbprg kbprb
KBSubcategory:


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 10, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.