How to run executable as Administrator via Command line?

For IT admins, understanding the command line is essential to managing systems. Often, it is necessary to run an executable as an administrator to perform certain tasks. Fortunately, there is a simple command-line method to do this.

To begin, open a command prompt as an administrator. This can be done in Windows by going to the Start Menu, typing in “cmd”, right-clicking on the “Command Prompt” icon, and choosing “Run as administrator”. For Mac users, open the Terminal app and type in “sudo” followed by your username and password.

Once you are in the command prompt, use the “runas” command to run the executable as an administrator. This is done by typing “runas /user:administrator ” where is the path to the executable you wish to run. For example, if you wanted to run the program “example.exe” located in the folder “C:\\Program Files\\Example Folder”, you would type “runas /user:administrator “C:\\Program Files\\Example Folder\\example.exe”.

Once you have entered the command, you will be prompted to enter the administrator’s password. After entering the correct password, the executable will run as an administrator. Note that the runas command can also be used to run programs as a different user other than the administrator. Simply replace “administrator” with the name of the user you wish to run the program as.

It is important to note that the runas command only works with programs that require administrator privileges to run. If you try to run a program as an administrator that does not require administrator privileges, it will not run correctly. Additionally, some executables may require additional parameters to be passed in order for them to run correctly. In these cases, the parameters must be included in the command line.

In summary, running an executable as an administrator from the command line is a relatively straight-forward process. Simply open a command prompt as an administrator, enter the runas command, enter the administrator’s password, and the executable will run as an administrator. Be sure to check the documentation for the executable to ensure that it is configured correctly and that it requires administrator privileges to run.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo