I've noticed that Linux symlinks don't work in Windows, and vice-versa. Is there any way to convert Linux symlinks to Windows symlinks? Specifically, I want to convert relative Linux symlinks to relative Windows symlinks (in case the folder with the symlinks is stored on a flash drive, or copied from a Linux filesystem to a Windows filesystem).
migrated from stackoverflow.com Jan 6 '13 at 2:52
This question came from our site for professional and enthusiast programmers.
|show 8 more comments|
Windows doesn't have symlinks per se. It has shortcuts, which are little more than special text files containing a destination location. They differ in features from symlinks. For example, this redirection on a POSIX system (including OS X):
will put the output of the command into whatever file the symlink points to, but on Windows
would simply overwrite the shortcut – you'd end up with a text file with a confusing extension.
On the other hand, Windows shortcuts can contain commandline arguments that change the actual nature of the command. Symlinks don't have this capability (though with shell aliases, functions and scripts, you don't really miss it.)
That said, you can create a shortcut file programmatically on Windows, so you can create a script that will try to create the right file for your platform.