Command-Line – How to Run Internal CMD Command from the MSYS Shell

command linemsysmsysgit

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 the mklink command is not executed and the CMD shell is not exited.

Before pressing Enter:

enter image description here

After:

enter image description here

Process Monitor screenshot:

enter image description here

  • Trying to run the command as a background process: cmd /c mklink & apparently works – the mklink command is executed, but the CMD shell is not terminated. Every time Enter is pressed, CMD will become the active shell.

Best Answer

  1. Search your %PATH% for cmd.cmd or cmd.bat. They may interfere with your cmd

  2. Run Process Monitor and run your cmd /c mklink. Examine ProcMon log for really executed commands.

Related Question