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.
I help organisations secure their cloud infrastructure and stay ahead of evolving cyber threats. Microsoft MVP and Certified Trainer, author of Mastering Azure Security, and founder of arnav.au — a platform for practical Cloud, Cybersecurity, DevOps and AI content.
Frequently Asked Questions
The RunAs command allows you to execute programs and commands as a different user without logging out and logging back in. It's particularly useful for system administrators and IT professionals who need to perform administrative tasks while logged in as a non-administrative user, or for anyone who needs to run applications under different user credentials.
The basic syntax is: runas /user:username command. For example, to open command prompt as an administrator, you would use: runas /user:admin cmd. After entering this command, you'll be prompted to enter the password for the specified user account.
The /savecred parameter saves the credentials (username and password) in the user's profile for future use, allowing you to run the command without being prompted for a password each time. However, this poses a security risk and should be used cautiously, as it stores sensitive credential information on the system.
When launching applications as a different user, you must specify the full path to the executable file. For example: runas /user:administrator "C:Program FilesGoogleChromeApplicationchrome.exe". This ensures the system can locate and launch the application under the specified user account.
PowerShell provides similar functionality using the Start-Process cmdlet with the -Verb RunAs parameter for running as administrator, or -Verb RunAsUser for other users. You can also supply credentials using the -Credential parameter, allowing you to specify which user account to run the script or command under.