If there’s a certain command that you want to run at will on a regular basis, you’ve probably grown tired of the cycle of launching the Command Prompt, typing in the command, closing the Command Prompt. There’s got to be a better way! And there is.
This method involves a creating file shortcut to
cmd.exe, which is the Command Prompt application, and supplying a command as a parameter. When a parameter is supplied to Command Prompt, it’s automatically run when launched.
- Right-click anywhere in File Explorer or the Desktop and select New > Shortcut.
- For the location of the item, type in
"C:\Windows\System32\cmd.exe" /k [your desired command here]making sure to replace the bracketed text with the command you want to run. Don’t actually type the brackets.
- Click Next.
- Give the shortcut a name.
- Click Finish.
/c if you want the Command Prompt to close after running the command. You can include multiple commands by adding an
& in there, such as
[command one] & [command two] & [command three].
You can also do something similar using Windows batch scripts, which are only a little more complicated. Just create a batch file, edit it to contain the command you want to run, save it, then double-click it.
Did this help? Know of any other ways to quick-run commands in the Command Prompt just by double-clicking a shortcut? Share with us in the comments below!