9

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).

13
  • 2
    Basically, 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. Jan 5, 2013 at 21:24
  • 1
    I'm a bit surprised - why did two people vote to close this question? Jan 6, 2013 at 1:42
  • I wish I could move this question to unix.stackexchange.com, since it would be more relevant there. :/ Jan 6, 2013 at 1:47
  • There are some search results about converting Linux symlinks to Windows symlinks: google.com/… Jan 6, 2013 at 2:41
  • 1
    Please 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? Jan 7, 2013 at 2:46

1 Answer 1

-3

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.

5
  • 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
  • 8
    As 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
  • 8
    Symlinks actually do exist in Windows. See here: superuser.com/questions/253935/… Jan 7, 2013 at 3:16
  • 1
    As 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
  • @JamesBarnett One notable issue is that symlinking normally requires admin privileges, so there isn't widespread use. For directory symlinks you have junctions though; it works pretty fine.
    – mcendu
    Jan 12 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .