Running programs through the graphical user interface is a pretty straightforward task. However, there are times when you might need to use an old-fashioned method of executing programs. This is done by using a command line interface such as the Command Prompt to run a program.
Using the command prompt to run programs may seem difficult, but there is really not much to it. There are a few things that you need to keep in mind when using a command line interface, and once you have them down, the rest of the process is painless.
1. Using the Runas Utility.
To run programs in the command prompt with administrative privileges, you have to use a built-in utility in Windows called Runas. Runas is a command-line interface utility that allows you to run programs on your computer with different permissions than your user account provides.
The utility follows a simple syntax that is quite easy to understand. Below, you can find the most generic syntax for Runas, which can be used to run a program.
runas /user:USERNAME "FILEPATH"
In the above command, we are providing a user account to be used for running the program located at the provided file path. To run the program as an administrator, you simply need to provide the command with an admin account. Once you do that, the program at the specified file path will be executed with administrative privileges.
2. Finding the File Path.
Now that you’re aware of the basic syntax for using the Runas utility, it is important to figure out the file path of the program you want to execute. In a graphical user interface, File Explorer keeps a record of our current location and uses it when we want to execute a program.
However, when you are using the command line interface, you will need to specify the exact file path of the program for it to be executed. Alternatively, you can use the change directory (cd) command to navigate the directories on your computer and open the folder where the program resides.
To find the file path of the program you want to execute, you can either use the File Explorer window and navigate to the location of the program, or you can search for the filename directly. From there, copy the address from the address bar in the File Explorer window and note down the name of the program’s executable file (.exe).
If you do not have access to the File Explorer window, you will have to use the change directory (cd) command to switch to the respective directory for the program. In case you already know the absolute path of the program, then this can be ignored.
Once you have the file path of the program you want to execute, all that is left to do is provide the specified command with an admin account and execute it.
3. Execute the Program with Admin Privileges.
Finally, now that you have the file path of the program you want to execute, you can simply run the command specified above with your respective changes. Follow the instructions below to accomplish this:
- First of all, press the Windows key + R on your keyboard to open the Run dialog box.
- In the Run dialog box, type “cmd” and press Enter.
- Now, in the command prompt window, type in the following command and make the respective changes:
runas /user:USERNAME "FILEPATH"
- Provide the password for the account when prompted.
- For example, if the username of the admin account is Hassam and the program to execute is Command Prompt, the command should look as follows:
runas /user:Hassam cmd.exe