Incorrect syntax when using mklink

Alasdair North - 

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
← other fixes or blog
I'm the CTO of viaLibri, a director and web developer at Runway, and an active member of St. Barnabas Church.

Latest Posts

comments powered byDisqus