The Windows CMD
utility has a number of internal commands, such as mklink
. How can they be used from the msys
shell ?
From CMD
's documentation, the /c
switch can be used to execute a command and
exit; but this doesn't seem to work.
- If I do
cmd /c mklink
themklink
command is not executed and theCMD
shell is not exited.
Before pressing Enter:
After:
Process Monitor screenshot:
- Trying to run the command as a background process:
cmd /c mklink &
apparently works - themklink
command is executed, but theCMD
shell is not terminated. Every timeEnter
is pressed,CMD
will become the active shell.
cmd /c mklink
works for me with my C shell, with Cygwinbash
and withcmd.exe
. But I did have to be running elevated or else I got complaints, "You do not have sufficient privilege to perform this operation." I haven't triedmsys
because I don't have it installed but I'm skeptical that's the problem. I'm suspicious there's something else going on. A transcript or a screen shot of what you did and what happened might be helpful.mklink
to work, the shell does indeed need to be run as administrator; but my problem is that I can't run any of the internal commands without thecmd
shell either taking over or running in the background. This issue is also present for simpler commands which do not require admin, such asdir
.cmd
?msys
converts/c
toc:\
. The answer is to escape it, and run the command ascmd //c mklink
.