1

Is it possible for me to create an ssh session on windows which then does some folder/file manipulation and then creates a NATIVE windows symlink.

i.e. a symlink that will be recognised by IIS and other app/services.

i've tried to create a symlink to a folder but all i get is a 1kb system file (with the same name) where the symlinked folder should be.

using ln -s SOURCE TARGET

i end up with target (system file, 1kb).

BUT in cygwin i can see the symlinked folder as normal.

3 Answers 3

1

Cygwin has its own symlink file format because native Windows symlinks don't have the right POSIX semantics. Worse, only administrators are allowed to create them.

If you do have administrator rights, cmd /c mklink can give you access to cmd.exe's builtin mklink command from a Cygwin session. Combine with cygpath to add POSIX path support, e.g.:

mklink() { cmd /c mklink "$(cygpath -w $1)" "$(cygpath -w $2)"; }
1
  • This unfortunately does not work in MinGW (e.g. the Git Bash Shell)... not just because of the cygpath bits but because the cmd /c just opens a CMD.EXE shell and leaves you there. Too bad, it's a clever trick!
    – iconoclast
    Sep 6, 2013 at 21:42
1

Two years later, but I have the answer

CYGWIN=winsymlinks:native
ln -s SOURCE TARGET

The CYGWIN environment variable

0

What you are looking for is called a junction in the Windows world. You can find a tool in the Sysinternals suite from Microsoft to do that, more precisely: http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx.

I know it is possible with folders but I don't think it applies to files, moreover it is not possible to create juntions of remote shares.

2
  • yeah, i'm aware of making the mklink calls on windows. i've tried to use a bat file with that, but then you get in to path issues etc. where unix style paths are different. it all starts to get messy. was hoping i could just make a call to cygwin and it translate that to a native symlink Sep 24, 2010 at 15:05
  • This kind of links are implemented at file system level so you are tight to what, in your case probably NTFS, is offering.
    – Cristian T
    Sep 24, 2010 at 15:22

You must log in to answer this question.

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