Create A Shortcut That Opens The Command Prompt & Runs A Command:
Yes! You can create a shortcut to cmd.exe with a command specified after it. Alternatively you could create a batch script, if your goal is just to have a clickable way to run commands.
Steps:
-
Right click on some empty space in Explorer, and in the context menu go to “New/Shortcut”.
-
When prompted to enter a location put either:
“C:\Windows\System32\cmd.exe /k your-command
” This will run the command and keep (/k) the command prompt open after.
or
“C:\Windows\System32\cmd.exe /c your-command
” This will run the command and the close (/c) the command prompt.
Notes:
-
Tested, and working on Windows 8 – Core X86-64 September 12 2014
-
If you want to have more than one command, place an “&” symbol in between them. For example: “
C:\Windows\System32\cmd.exe /k command1 & command2
“.