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

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:

 

rudnas /noprofile /user:Administrator cm

 

Here’s the syntax of runas command:runas [{/profile|/noprofile}] [/env] [/netonly] [/smartcard] [/showtrustlevels] [/trustlevel] /user:UserAccountName program

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.

Did you find this article interesting? Don’t forget to drop your feedback in the comments section below.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *