The Runas command enables a user to perform tasks such as running a specific program with different permissions than what is currently available. Admins commonly use it to quickly perform administrative tasks while logged in to a non-admin account.
We’ve detailed how to use the Runas command, common use cases and examples, parameters, and related errors in the article below.
How to Use Runas Command as an Administrator
The Runas Command is commonly used with the /user
parameter to perform tasks as an administrator. We’ve listed some useful Runas command examples below.
- First, let’s look at the syntax. You can copy either of the following formats and replace the device and account name with your own credentials:
Runas /user:AdminAccountName@DeviceName
Runas /user:DeviceName\AdminAccountName
- If you’re trying to access a domain administrator account, you should use the DomainName instead, as shown below:
Runas /user:AdminAccountName@DomainName
Runas /user:DomainName\DomainAdminName
You can use the runas command to open .exe
files, .msc
files, Control Panel items, and shortcuts to programs and saved MMC consoles. We’ve listed the syntax to do so and a few examples below.
- The following command uses the filename to launch a command prompt window as an administrator:
Runas /user:DeviceName\AdminAccountName filename
- The following command uses the file path to launch an application as an administrator:
Runas /user:DeviceName\AdminAccountName “filepath”
- The following command launches Computer Management using a domain administrator account:
Runas /user:DomainName\DomainAdminName "mmc %windir%\system32\compmgmt.msc"
- The following command opens a text file in a domain using Notepad. It uses a domain admin account named Jacques in a domain called domain.tnt.com to open a file named file1:
Runas /user:jacques@domain.tnt.com “notepad file1.txt”
Runas Command Parameters
In addition to /user
, there are a few other switches that can come in handy. We’ve concisely explained their functions below.
/noprofile
– The user’s profile is loaded by default, but this option specifies it shouldn’t be loaded./env
– This option specifies to use the current network environment instead of the user’s local environment./netonly
– This option indicates that the specified credentials are for remote access only./savecred
– This option specifies to use credentials previously saved by the user./trustlevel
– This option specifies the authorization level to run the program at./showtrustlevel
– This option lists the trust levels that can be used as arguments to /trustlevel
.
We recommend checking Microsoft’s Runas documentation for the full list of parameters.
How to Fix ‘The Requested Operation Requires Elevation’ Error When Using Runas Command?
First, you could use the /showtrustlevel
parameter to check if you can elevate the trust level, and if it’s possible, you can do so with the /trustlevel
parameter.
In cases where you’re unable to elevate the trust level any higher, you can apply a workaround. You can enable the default admin account with the following command:net user administrator /active:yes
This account has higher privileges than a user-created admin account, so you’ll be able to use the runas command without any issues.