Making cygwin, Windows and emacs understand the same symlinks

September 28, 2010

Today I ran into the problem that symlinks created under cygwin using "ln -s" are not understood by Windows, and of course Windows shortcuts are seen by cygwin as regular files. Happily, this is a (semi-)solved problem. For reference, this is what needs to be done:

  1. Add "winsymlinks" to your CYGWIN environment variable. For example, in my .bashrc I have the following:

    export CYGWIN="nodosfilewarning winsymlinks"

    This makes cygwin create symlinks differently, in a form that is understood both by it and by Windows.
    This is the main step, and the only one if you just need access from the shell and from the Windows explorer. However, emacs still sees those symlinks as regular .lnk files. To fix this, follow the next step.