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).
1 Answers
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):
./somecommand > ./somesymlink
will put the output of the command into whatever file the symlink points to, but on Windows
somecommand > someshortcut.lnk
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.
- 243