Registry key to force Windows to use short filenames

I thought this was interesting - there is a way that you can globally force Windows to use short filenames (also known as 8.3 filenames because they were limited to 8 characters for the name and 3 characters for the extension) or alternatively allow Windows to use long filenames that are not bound to the 8.3 naming restrictions. This is the key name and value:

  • Key name: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem
  • Value name: Win31FileSystem
  • Data type: REG_DWORD

Setting this value to 0 will allow Windows to use long filenames. Setting this value to 1 will force Windows to use short filenames.

When you use the SHORTFILENAMES property in Windows Installer, that is the equivalent of forcing 8.3 filenames but only for a single MSI installation. This registry key controls 8.3 file naming for the entire system, and I have seen this be the cause of 1325 errors ('[2]' is not a valid short file name) when installing MSI packages in some rare cases.

Some setup authors do not pay attention to the setting in the file table for the short file name value and inadvertantly provide a short file name that is greater than 8 characters long. Then when someone tries to install that MSI on a system that has the Win31FileSystem value = 1 or the SHORTFILENAMES property set, they get a 1325 error. For example, you will see this if you try to install Visual Studio .NET 2003 on a machine that has this registry value set because we did not pay enough attention to the short file name values we provided in the MSI. One of the files has a short file name value of "Microsoft" which has 9 characters instead of 8.