How to create shortcut for a command in Windows

Sometimes when you need to write and run some commands a few times then typing the whole command is a headache, but many cases you can create a shortcut to run commands on cmd in your Windows operating system or you can create a simple bat file and run them whenever you need.
Recently I wrote about creating virtual Wi-Fi with the command prompt that requires you to execute commands for turning Wi-Fi hotspot on and off, but you can create a shortcut for cmd commands and run that command with just one click.

How to run commands with just one click in Windows

  • Create a new shortcut paste cmd.exe's path followed by "k/ example command, if you want the command prompt to run a command then remain open.
C:\Windows\System32\cmd.exe /k example-code

  • In case if you want command prompt to run command and close itself create shortcut with the following code :-
C:\Windows\System32\cmd.exe /c example-code
You can learn about the batch files in detail here.

Posted in:



Liked us? Tell your friends on Facebook!

0 comments:

Post a Comment