Overview
Some clients have reported not being able to open Microsoft Excel files when the total path length (including all folders names) exceeds 218 characters. For Microsoft Excel files in particular, this has always been an imposed limitation by Microsoft.
Furthermore, even though Windows 10 is now finally capable of handling the long-path problem if you make a registry change (https://social.msdn.microsoft.com/Forums/en-US/fc85630e-5684-4df6-ad2f-5a128de3deef/260-character-explorer-path-length-limit?forum=windowsgeneraldevelopmentissues), this will still not work with some 32-bit applications such as the Windows Client. When you try to open an Excel file with an extremely long name from the Windows Client's mounted drive, you may see the error below:
"Microsoft Excel
Sorry, we couldn't find [long path here]. Is it possible it was moved, renamed or deleted?"
(Screenshot of the Excel error)
The patronizing recommendation from Microsoft is to simply make your folder and file names shorter:
"Make sure that the path to the file contains fewer than 219 characters. To do this, use one of the following methods:
- Rename the file so that it has a shorter name.
- Rename one or more folders that contain the file so that they have shorter names.
- Move the file to a folder with a shorter path name."
Workaround
There is a workaround for this issue that may work for users who don't mind one extra step when opening files that refuse to work. With the scripts provided in this article, you will add a contextual menu option to Windows File Explorer to "Open with Shorter Path." This command will automatically create a temporary drive to shorten the path of the folder names to just a single letter and then open the file from that temporary location instead. Internally, this solution uses the "subst" command to achieve create the temporary drive. The only drawback is that if the file name itself exceeds over 200 characters, theoretically, this should not work. But, this may help you to get around most of your long path problems.
To implement this solution, simply download the included openWithShorterPath-v2.zip attachment. Run the openWithShorterPath.reg command to add the command to File Explorer. Then, save the mapKAndOpen.bat file directly in the root of your C:\ drive. If you already have a K drive on your computer, you can edit the bat script so it uses another letter instead of K.
Contents of openWithShorterPath.reg:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open with Shorter Path\command]
@="C:\\mapKAndOpen.bat \"%1\""
Contents of mapKAndOpen.bat:
@echo on
subst.exe K: /D
subst.exe K: "%cd%"
explorer K:\%~nx1
exit
After the scripts are installed, you should now be able to open the long-path files via right-clicking and selecting "Open with Shorter Path."
Comments
0 comments
Please sign in to leave a comment.