How to run a program as Administrator via Command Prompt?

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.

Running Programs with Command Prompt

Using the command prompt to run programs can 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 Runas Utility

To run programs in the command prompt with administrative privilege, you will 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 that your user account provides. 

The utility follows a simple syntax that is quite easy to understand. Below is the most generic syntax for Runas that you can use to run a program.

runas /user:USERNAME "FILEPATH"

In the above command, we’re providing a user account that is to be used to run the program that is located at the provided file path. To run the program as an administrator, you will have to simply provide the command with an admin account. Once you do that, the program at the specified file path will be run 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 that you want to execute. In a graphical user interface, the File Explorer keeps a record of our current location and uses that when we want to execute a program.

However, when you’re 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 the location of the program. 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 is to provide the specified command with an admin account and execute it. 

3. Executing 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 do this:

  1. First of all, press the Windows key + R on your keyboard to open the Run dialog box. 
  2. In the Run dialog box, type in cmd and hit Enter.
  3. Now in the command prompt window, type in the following command and make your respective changes:
    runas /user:USERNAME "FILEPATH"
  4. Provide the password for the account when prompted. 
  5. For example, if the username of the admin account is Hassam and the program to execute is command prompt, the command should look as follow:
    runas /user:Hassam cmd.exe
    Running Programs with Command Prompt
ABOUT THE AUTHOR

Muhammad Zubyan


Muhammad Zubyan is a certified Google IT Support Professional with over 7 years of extensive experience. He has worked on more than 1500 computers, gaining valuable insights that enable him to detect and troubleshoot any complicated root cause of Windows-related issues and errors. In addition to managing Appuals as a Senior Editor, he is currently developing his own Game Optimization program that caters to both gamers and casual users alike.
Back to top button

Expert Tip

How to run a program as Administrator via Command Prompt?

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested