DEV Community

Cover image for "🏃‍♂️" Command in Windows
NITIN B
NITIN B

Posted on

"🏃‍♂️" Command in Windows

Recently, I was wondering how the RUN in windows works, and i discovered how we can use it by customizing.

HOW ?

Image description

So lets see how it runs,

Actually run is a shortcut for running applications or services.
When we type the command or the keyword for the application the os will look into the system variables and finds the path where system32 is located (c:\windows\system32\) and finds the application and if it exists it runs the application. The system32 basically holds all the commands that can be used in the command prompt and the shortcut to run application.

Customized run

Image description

1. By using a executable file:
We have a sample.bat. This is a batch file containing,

@echo off
echo Hello, %USERNAME%!
echo This is a test script.
Enter fullscreen mode Exit fullscreen mode

This sample.bat file which is stored in c:\user\desktop\scriptsor in any other folder you like. This path of the file should be pasted in the system variables PATH (Settings > about pc > advanced system settings > environment variables > system variables) by creating a new path paste the file location (c:\user\desktop\scripts)

This can be done with any executable files and not just batch files.

2.By using a shortcut:
We can run our customized command for applications by creating a shortcut in the system32 folder.

We can take the text.bat as a shortcut.
We can create a shortcut by right click > new > shortcut and find the file that you need to create a shortcut.

Now store the shortcut in the system32 folder (c:\windows\system32\).

After executing any of these methods you can now able to run the customized run by using the shortcut name or the file name.

Image description

Top comments (0)