Short Bytes: Sudo command is one of the most used tools by Linux system administrators. Windows users can use runas, a command with similar functionality on Windows Vista and above. Runas command allows you to run specific programs and tools with permissions different than the user’s current permissions.
Is there any particular command in Windows that executes the commands with administrator privileges? Is there some Windows equivalent of sudo command in PowerShell or Command Prompt? — Such questions are often asked by the eager users on our Facebook page. So, to address those queries, I’ve decided to write this article.
Runas — sudo equivalent in PowerShell (kind of)
Runas in Windows operating system enables a user to execute a program under a different user account. You can also consider it a means to execute a program on your friend’s computer as yourself or as a different user.
To use runas in the command line, open a Command Prompt window, type runas followed by the appropriate parameters and hit Enter.
Here’s the syntax of runas command:
For instance, to start a command shell as administrator, simply run the following command:
Here are the different parameters as specified by Microsoft:
Please note that while dealing with runas command in Windows, enter the user’s password only when your OS prompts you to do so.
Another important point one should note is that runas command in Windows Vista and above predates the permission elevation by right-clicking and choosing “Run As Administrator”. Also, if you are already running an elevated command shell, runas won’t make any difference.
For detailed information and usage, you can visit this article on Microsoft’s TechNet website.
Did you find this article interesting? Don’t forget to drop your feedback in the comments section below.