Did you know that you can run any Command Prompt command through a Windows shortcut that will be on your desktop?

Of course, you can open the Command Prompt and just type the command you want. Or if you want to run more commands, you could create a script yourself (e.g. a bash script or a PowerShell script). But if you use certain Command Prompt commands often, it's not a bad idea to make shortcuts and run them with a double-click instead of typing entire strings each time. Let's see how you can do that.
1. Create a shortcut by right-clicking anywhere on your desktop or in File Explorer and selecting New > Shortcut.
2. In the “Create Shortcut” window that opens, type your command, using the following syntax:
"C:\Windows\System32\cmd.exe" /k yourcommand
The first part (the part in quotes) simply calls the cmd.exe command to open the command prompt. The /k switch tells Command Prompt to run the command that follows and then stay open so you can see the results or watch the process. You can also use the /c switch instead of the /k switch (use only one of the switches) if you want the Command Prompt window to close after issuing the command. And of course, yourcommand is the actual command you want to run.
For example, if you want to create a simple command to run the system file checker to find and fix problems with your system files, you would type the following:
"C:\Windows\System32\cmd.exe" /k sfc /scannow
3. When you have created the command you want to use, click “Next.” Type a name for the shortcut, and then click the “Finish” button.

Now, you can run the shortcut instead of opening Command Prompt and typing the command manually each time.
Another neat trick you can do is to send the results of a command directly to a text file (or another program). For example, let's say you want to run the command ipconfig /all , and have the results saved to a file named ipconfig.txt on your desktop, and have the command prompt window close after the command is finished. You could use the following command:
"C:\Windows\System32\cmd.exe" /c ipconfig /all > "c:\users\username\Desktop\ipconfig.txt"
If you use the > symbol in the above command and the file ipconfig.txt already exists, then Windows will overwrite the contents of the file with the new results, so be careful not to lose any data that you may need. If the file does not exist, then Windows will create it. You can also use a double >> so that Windows will append the new results without erasing the old contents of the file. Especially useful if you want to keep a history of the results of a command.
