Create a desktop shortcut for a command

We’ve talked before about the many uses of the Command Prompt in Windows. Did you know that if there’s a command you need to run frequently, you can create an easy desktop shortcut to launch it?  For the purpose of this article, I’ll pick the command ‘chkdsk’ which is used to identify and correct hard drive errors.

To launch it, you’d normally search for cmd in your Windows search box, then right-click on the result.

Choose Run as administrator.

When the command prompt opened, you would type the command chkdsk after the prompt and press the enter key.

To keep a command handy on the desktop, click on a blank spot on the desktop and choose New and then Shortcut. 

A window will open asking for the location of the item you’d like to create the shortcut for.

You have two options with a command prompt command. One is to run the command and leave Command Prompt open. The other is to run the command and close Command Prompt. 

If you want to run the command and leave it open, type

C:\Windows\System32\cmd.exe /k Example

You’ll swap out Example with your desired command. In this case:

C:\Windows\System32\cmd.exe /k chkdsk

If you’d like it to close after running, type  C:\Windows\System32\cmd.exe /c Example

In this case, C:\Windows\System32\cmd.exe /c chkdsk

Then hit Next.

Name the shortcut, then click Finish.

Now, you’ll have a desktop shortcut that can run that command with a click.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.