Last Updated on August 7, 2025 by Arnav Sharma
The RunAs command is an invaluable tool for Windows users, particularly for system administrators and IT professionals. It allows you to execute programs and commands as a different user without the need to log out and log back in. This can be especially useful for performing administrative tasks while logged in as a non-administrative user. In this blog, weโll explore the various uses and parameters of the RunAs command and provide practical examples to help you get the most out of this powerful feature.
Introduction to RunAs cmd
Introduced back in Windows 2000, the RunAs command has been a staple in the Windows operating system, available in all subsequent versions. It allows you to run applications and commands under a different user account than the one currently logged in. This feature mimics the โRun as administratorโ option you get when you right-click an executable in the user interface.
Administrators often use RunAs to perform tasks with elevated privileges without having to switch users. However, the command isnโt limited to administrators; any user with the necessary permissions can leverage it to run programs under different credentials.
Basic Usage
Using the command line, you can run a program with elevated permissions. RunAs command is straightforward. The basic syntax involves specifying the user account and the program you want to run. For example, to open the command prompt as an administrator:
runas /user:admin cmd
Youโll be prompted to enter the password for the specified user, and upon successful authentication, the command will execute.
Parameters and Options
The RunAs command comes with several parameters that enhance its functionality. Hereโs a rundown of the most commonly used ones:
- /user: Specifies the user account to run the program as.
- /noprofile: Prevents the userโs profile from loading, making the application start faster. By default, the profile is loaded.
- /env: Uses the current network environment instead of the userโs local environment.
- /netonly: The credentials are used only for remote access.
- /savecred: Saves the credentials (username and password) in the userโs profile for future use. This can be a security risk, so use it cautiously.
- /smartcard: Uses smart card for authentication.
- /showtrustlevel: Displays available trust levels.
- /trustlevel: Specifies the trust level to run the program on.
Hereโs the general syntax for using RunAs with parameters:
runas <parameters> /user:<username> <command>
Practical RunAs Examples
Letโs explore some practical examples to illustrate how the RunAs command can be used effectively.
Running Command Prompt as Administrator
To open the command prompt with local administrator privileges:
runas /user:administrator cmd
To use a domain administrator account:
runas /user:yourdomainadministrator cmd
Opening Administrative Tools
If you need to open administrative tools like services.msc, you should prefix the command with MMC:
runas /user:administrator "MMC services.msc"
Running Programs as Another User
When launching applications like Google Chrome as a different user, you must specify the full path to the executable:
runas /user:administrator "C:Program FilesGoogleChromeApplicationchrome.exe"
PowerShell Equivalent
PowerShell provides a similar capability with the Start-Process cmdlet, which can be used to run scripts and commands as different users:
# Run as admin
Start-Process powershell -Verb RunAs # Run as other user Start-Process powershell -Verb RunAsUser
You can also supply credentials for the administrator account:
# Store the credentials
$Cred = (Get-Credential) Start-Process powershell "-File c:pathtoscript.ps1" -Credential $Cred
# Single-line command
Start-Process powershell "-File c:pathtoscript.ps1" -Credential (Get-Credential)
The RunAs command is a powerful utility that simplifies the process of executing tasks with different user credentials. Itโs particularly useful for administrators who need to perform elevated tasks without switching user accounts. However, itโs important to handle credentials carefully, especially when using options like
/savecred, which can pose security risks.