INFO: File Manager Passes Short Filename as Parameter (98575)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows NT 3.1
    • the operating system: Microsoft Windows NT 3.5
    • the operating system: Microsoft Windows NT 4.0
    • the operating system: Microsoft Windows 2000
    • the operating system: Microsoft Windows XP

This article was previously published under Q98575

SUMMARY

When starting an application from File Manager or Explorer by double-clicking a document associated with the application, if the document resides on an NTFS partition and has a long (non-8.3 form) filename, File Manager (or Explorer) will pass the short version of the filename (also known as the MS-DOS alias or 8.3 name) to the associated application if the application is an MS-DOS or 16-bit Windows-based application. This is done for compatibility reasons; applications not aware of long filenames (16-bit Windows-based applications) can still function correctly. 32-bit Windows-based applications will be passed the long file name.

This can create confusion, however, if the application displays the name of the file the application was started with; the short name is displayed even though the long name was double-clicked.

You can avoid possible confusion by always expanding any filenames passed to an application via the command line. Do this by calling the FindFirstFile() application programming interface (API) on these filenames. FindFirstFile() will always return the file system's version of the filename in the WIN32_FIND_DATA.cFileName structure member, which the application can then use in all further references to the file without any problems.

Modification Type:MajorLast Reviewed:3/29/2004
Keywords:kbFileIO kbinfo kbKernBase KB98575