Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Jan 6 '13 at 2:52

This question came from our site for professional and enthusiast programmers.

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

1 Answer 1

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.

share|improve this answer
    
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. –  Anderson Green Jan 6 '13 at 21:53
2  
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. –  Harry Johnston Jan 7 '13 at 1:25
2  
Symlinks actually do exist in Windows. See here: superuser.com/questions/253935/… –  Anderson Green Jan 7 '13 at 3:16
    
As of Windows Vista you can create symlinks using the 'mklink' command see: en.wikipedia.org/wiki/NTFS_symbolic_link –  JamesBarnett Jan 7 '13 at 3:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.