I understand that Windows later-than-or-equal-to Vista provides the mklink
shell command. I'd like to make use of this from the Msys terminal. Any idea how?
When I enter mklink
on the msys terminal, it outputs sh: mklink: command not found
. Msys only provides a fake ln
utility which appears to be effectively the same as cp
.
I tried writing a shell script to open a Windows shell and run mklink
within it, but when my shell script tries to execute cmd /C <instructions>
, msys brings the Windows shell to the foreground of the current terminal and leaves it there, without running the instructions.
Best Answer
Using
cmd //c mklink
directly on the MSYS bash command line should work.Note: The mklink command and arguments need to be provided as a single argument to cmd. Quote the entire command like so
Note that the command would normally be
which would work in Cygwin and other shell environments, and even in an existing CMD session. However, msys seems to mangle command-line arguments (to Windows commands), and it interprets
/c
as a pathname to the root of theC
disk, and converts it toc:\
. Typing//c
has been found to cause msys to pass the/c
option tocmd
. See How to run internal cmd command from the msys shell?