CreateShortCut truncates destination filename on non-existing network drive

From NSIS Wiki
Jump to navigationJump to search
Author: virtlink (talk, contrib)


Issue
When using CreateShortCut, the destination filename becomes truncated when the file is on a network drive which isn't available at the moment.
Cause
The filename is probably a long filename (e.g. a filename with more than 8 name characters and/or more than 3 extension characters) and points to a file on a network drive. Since Windows can't find the file, it can't get the 8.3 filename. And Windows can't be sure that the filesystem supports the longer filename. Then Windows truncates the filename to the 8.3 format to be sure.
Solution
Be sure to map the drive before creating the shortcut. Or use 8.3 filenames.