Run Command Prompt Commands from Windows Shortcut | You can definitely do it yourself.

how to run command prompt commands from windows shortcut.

How to Run Command Prompt Commands from Windows Shortcut

 Did you know that you can use shortcuts to execute commands from the Command Prompt? Here's how to do it:

1. Create a shortcut by right-clicking anywhere in File Explorer or your desktop and selecting New > Shortcut.


2. In the “create shortcut” window, type your command using the following syntax:

"C:\Windows\System32\cmd.exe" /k yourcommand

The first part (the part in quotes) calls cmd.exe to open the Command Prompt. The “/k” tells the Command Prompt to issue a command to follow, and then it stays open so you can see the result or type the next command. You can also use “/c” if you want the Command Prompt window to close after issuing a command. And of course, the “yourcommand” part is the command you want to run.

For example, if you wanted to create a simple command to run the system file checker to find and fix problems with system files, you would type the following command:

"C:\Windows\System32\cmd.exe" /k sfc /scannow


3. Once you have finished creating the command, click “Next.”

4. Type a name for the shortcut and then click “Finish.”


Now, you just run the shortcut and no longer need to open Command Prompt and type commands manually every time.

Another thing the shortcut can do is save the command results to a text file (or other program). For example, you want to run the command “ipconfig /all”, and want the results to be saved in a file called ipconfig.txt on your desktop, and after that close the command prompt. Then you can use the following command:

"C:\Windows\System32\cmd.exe" /c ipconfig /all > "c:\users\username\Desktop\ipconfig.txt"


And done!

Hopefully, this article about Run Command Prompt Commands from Windows Shortcut, gives you a little insight. Also, read an article about Running Multiple Windows Applications at Once With One Click that you may need to know. Thank you.

Previous Post Next Post