Steps To Run Command Prompt Commands From Desktop Shortcuts:- You might be a Command Prompt lover. But there could definitely be some commands that you use on a frequent basis and opening Command Prompt and executing these commands every single time would actually make you go nuts. Is there a solution for this? Yes, of course, there is. You could pack in all your frequently used Command Prompt commands in a single shortcut and double click on this shortcut whenever you want to execute these commands. Yeah, as simple as that. Let’s see the various methods using with you can achieve this. What are you waiting for then? Let’s get started, shall we?
Execute Single CMD Command Through Desktop Shortcut
- Right click on an empty space anywhere on your Desktop screen. From the context menu that appears, click on New and then on Shortcut options.
- You need to give the location of the item in the window that follows.
- Type in or copy paste
C:\Windows\System32\cmd.exe /k The_Command_You_Want_To_Execute.
- Please refer to the following screenshot if you have any doubts. For example lets say you have to create a desktop shortcut for ipconfig command. So, we will write C:\Windows\System32\cmd.exe /k ipconfig in the location of the item.
- As next, give your shortcut a name. In the given screenshot, I have named the shortcut as Merabheja Command. Hit the Finish button when you are done.
- Simply double click on your newly created shortcut to execute your command. That’s it.
- Now you can see your command executed in the Command Prompt.
Execute Multiple CMD Commands From A Single Shortcut
If you wish to execute multiple CMD commands through a single desktop shortcut, you can even accomplish that. For that you need to follow the same steps as described above. When giving the location of the item, you can type in multiple commands separated by ampersands(&) to execute them one by one from a single shortcut.
Execute CMD Commands Through Batch Files
- You need to launch the Notepad first. Simply type in your commands one by one and add a pause at the end. Otherwise the CMD would close abruptly once the commands are executed.
- Once you are all done, save the file as a batch file. You can give any name for your file as per your choice. But make sure that the extension for your file is .bat. Now you can just go to the location where this batch file is saved and double click on it to execute your commands. That’s it.
What To Do If The Command Is not Recognized When You Double Click On A Batch File To Execute A Command?
- Sometimes when you create a batch file and double click on it, the CMD would open, but you would receive a message saying that the command is not recognized. In such a case, you need administrative privileges to run the command embedded in the batch file. For that, create a shortcut of the batch file in question by right clicking on it and then by clicking on the Create shortcut option.
- Once the shortcut is created, right click on it and choose the Properties option.
- As next, click on the Advanced button under the Shortcut tab as shown in the screenshot given below.
- Now check the checkbox corresponding to the Run as administrator option and hit the OK button. That’s it. Now try double clicking on the newly created shortcut and see if it is working fine.
Hope you found the article useful. If you have any doubts regarding any of the steps, please feel free to leave comments, we would be happy to help. Stay tuned for more useful tricks, tips, and hacks.