Run Command Prompt commands from a Windows shortcut

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

command_prompt

Of course you can open it Command Prompt (Command Prompt) and simply type the command you are interested in. Or, if you want to run more commands, you could create a script yourself (eg a bash script or a PowerShell script). But if you often use some specific Command Prompt commands, then it's not a bad idea to make shortcuts and run them with a double click instead of typing full-length rows every time. Let's see how you can do this

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

2. In the "Create Shortcut" window that opens, type your command using the following syntax:

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

The first part (the part in quotation marks) simply calls the cmd.exe command to open the command line. The / k switch tells the Command Prompt to run the following command and then stay on so that 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 line window to close after the command is issued. And of course, yourcommand is the actual command you want to run.
For example, if you want to create a simple command to run system file checker "file check" to find and fix problems with your system files, you will enter the following:

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

3. When you create the command you want to use, click "Next". Enter a name for the shortcut, and then click Finish.

shortcut

Now you can run the shortcut instead of opening the Command Prompt and typing the command manually at a time.

Another intuitive 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 ipconfig / all command, and its results stored in a file named ipconfig.txt on your desktop, and the command-line window closes when the command is run. 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 ipconfig.txt file already exists, then Windows will replace the contents of the file with the new results, so be careful not to lose any data you may need. If the file does not exist then Windows will create it. You can also use a duplicate >> so that Windows can add new results without deleting the old contents of the file. Especially useful if you want to keep a history of the results of a command.

iGuRu.gr The Best Technology Site in Greeceggns

Get the best viral stories straight into your inbox!















Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).