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).
-
2Basically, this question is asking whether it's possible to generate Mac and Windows symlinks on Linux, since creating cross-platform symlinks doesn't appear to be possible.– Anderson GreenJan 5, 2013 at 21:24
-
1I'm a bit surprised - why did two people vote to close this question?– Anderson GreenJan 6, 2013 at 1:42
-
I wish I could move this question to unix.stackexchange.com, since it would be more relevant there. :/– Anderson GreenJan 6, 2013 at 1:47
-
There are some search results about converting Linux symlinks to Windows symlinks: google.com/…– Anderson GreenJan 6, 2013 at 2:41
-
1Please clarify: do you want to create shortcuts, or symlinks? If they're being created on an ext4 volume, which Windows can't read, what's the point? Put another way, how are they going to eventually wind up being seen by Windows?– Harry JohnstonJan 7, 2013 at 2:46
1 Answer
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.
-
Would it also be possible to generate a shortcut file for Linux on Windows? I hope it would be possible to generate Linux symlinks from Windows shortcuts, and vice versa. Jan 6, 2013 at 21:53
-
8As well as shortcuts, Windows also has symbolic links, junction points, and hard links. They tend to stay hidden under the covers, as it were, but they exist. Jan 7, 2013 at 1:25
-
8Symlinks actually do exist in Windows. See here: superuser.com/questions/253935/… Jan 7, 2013 at 3:16
-
1As of Windows Vista you can create symlinks using the 'mklink' command see: en.wikipedia.org/wiki/NTFS_symbolic_link Jan 7, 2013 at 3:41