If you need quick access to a frequently used command, you can create desktop shortcut for Command Prompt commands. Here’s how.
If you are a regular Command Prompt user, there might be some commands that you use on a daily basis. For example, I have a simple command that copies data from one folder to the other on a schedule. From time to time, I also manually execute the command to copy the data. Since the command is just a single line, I’ve created a desktop shortcut for that Command Prompt command. Since then, all I have to do is double-click on the shortcut to execute the command. No need to manually open the Command Prompt and then manually type in the command.
So, if you are ever in this kind of situation, follow the below steps to create desktop shortcut for Command Prompt commands.
Steps to Create Desktop Shortcut for Command Prompt Commands
Since this is a simple desktop shortcut, we can create it with the shortcut creation wizard available from the desktop’s context menu.
1 . First, right-click on the desktop and select “New → Shortcut” option. This will open the shortcut wizard.
2. In the blank field, enter the following command while replacing “YOUR_COMMAND_HERE” with the actual command you want to execute. Click on the “Next” button.
C:\Windows\System32\cmd.exe /k YOUR_COMMAND_HERE
For example, I want to ping a website, so I replaced the dummy command like this.
C:\Windows\System32\cmd.exe /k ping google.com
3. Here, type the name of the shortuct. It can be anything you want. Click on the “Finish” button.
That is it. From now on, simply double-click on the shortcut and the command will be executed in the Command Prompt window.
If you want to, you can also run multiple commands using the same desktop shortcut. All you have to do is modify the above command a little bit.
To execute multiple commands with the desktop shortcut, use the below command. Don’t forget to replace the dummy commands with the actual commands.
C:\Windows\System32\cmd.exe /k FIRST_COMMAND & SECOND_COMMAND
As you can see, all we did is separate the commands with
& operator. It tells the Command Prompt to execute both first and second commands one after the other. You can execute as many commands as you want with this trick.
Do keep in mind that when you execute multiple commands, the Command Prompt will execute the commands one after the other and not simultaneously.
Note: The above method cannot execute commands that require admin rights. For that, create a shortcut with admin rights to run programs as an administrator.
(Optional) Change Icon
If you are not a fan of the default Command Prompt icon, you can customize the shortcut icon. Simply right-click on the shortcut and select “Properties”. Now, click on the “Change Icon” button, select your favorite icon and then click on the “Ok” button to apply it.
That is all. It is that simple to run Command Prompt commands with a desktop shortcut. If you like to keep your desktop clean then add the shortcut to the quick launch toolbar for quick access.
I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible. If you like this article, do check out how to create a clear clipboard shortcut on desktop in Windows.