Is There An Equivalent Of “Sudo” Command For Windows?


cmdprompt-runasShort 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.

In Unix-like operating systems, the root account isn’t configured by default. Using the “sudo” command, a Linux user can take the complete control of his/her system and install, remove, or change any piece of software. Sudo provides the root privileges that also secure the security of a system.

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:

runas [{/profile|/noprofile}] [/env] [/netonly] [/smartcard] [/showtrustlevels] [/trustlevel] /user:UserAccountName program

For instance, to start a command shell as administrator, simply run the following command:

runas /noprofile /user:Administrator cmd

Here are the different parameters as specified by Microsoft:windows-runas-command

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.

Also Read: How To Download Packages Faster In Linux Using APT-FAST Command?

Similar Posts