DOS Compatable File Names

Who remembers the DOS days when files could only be 8 characters long with 3 character extensions?  Do you remember when Microsoft introduced long files names in Windows 95?  In order to maintain backward compatibility, the system still created 8.3 files names.  Well every version of Windows still does that, even Windows 7.  This can be disabled for performance reasons by setting HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem:NtfsDisable8dot3NameCreation=dword:00000001 (http://support.microsoft.com/kb/121007) but you never know when you will need them. [more]

I was running an application that had been installed down under C:\Program Files, and it’s configuration file was there, and I needed to pass that as a parameter to the program.  I tried using quotation marks, backslashes to quote the spaces, backslashes to quote the quotation marks, quotation marks to quote the quotation marks – everything I could think of it and still did not work.  Using the short file name with no spaces worked great.

I had some directories created that were made up of only spaces and I could not delete or rename them.  The Windows Easy Transfer would get stuck in a loop because of these, so I decided I better delete or rename them.  I did a dir/x to find the short names, and then I could access them using that.

If you want to find the “short name” path, just run the good ole’ trusty DOS COMMAND.COM.  It’s still there, even on Windows 7!.  Just enter command at the command prompt and a cd if your prompt does not indicate your path.

One side effect to look out for.  Since the short name is based on the first few characters of the long name, renaming the long name and leaving the first few characters the same will result in the short name staying the same.  So you cannot just rename the file to “long file name with spaces-old.txt” to get it out of the way if something is accessing LONGFI~1.TXT.  Renaming it to .old would work.

Networking DOS Windows