I was trying to use mklink in a script to create symlinks on Windows. When it works it's really handy, and brings a useful concept from the Linux world onto Windows. But, I was getting a syntax error.
C:\>mklink.exe /D Bar C:\Foo
The syntax of the command is incorrect.
I was sure this command had worked in the past, but I couldn't find out what the problem was by searching. After a little experimentation I found the problem was the .exe
suffix. I guess mklink
is somehow part of the shell environment and isn't an executable.
So, the solution is to call it without .exe
:
C:\>mklink /D Bar C:\Foo
symbolic link created for Bar <<===>> C:\Foo