contador Skip to content

5 Windows alternatives to the Linux sudo command

If you've ever used Linux or know someone who uses Linux, you've probably heard of the sudo command. The command is a fundamental component for almost all Linux distributions and what makes you run a command as a different user, especially the root user. On certain Linux distributions, you can log in as root using the command up, but this considered highly risky and nobody ever does.

In fact, so dangerous that it is disabled by default on Linux distributions like Ubuntu. Instead, you have to use the command sudo if you want to run a command as root. So what about Windows? Well, unfortunately, most people have logged in to Windows as administrators, which is the same root user in Linux. However, Microsoft has tried to reduce the dangerous effects of being logged in as an administrator by enabling User Account Control or User Account Control.

This way, even if the user has administrative privileges, applications running under that account will not inherit those privileges unless they are manually authorized by the user. It allows us to prevent malware and spyware from infecting a Windows user who is logged in as an administrator.

So while Linux users have the sudo command, what do Windows users have? Are there alternatives that Windows users can use to run commands with elevated privileges? Is there a sudo command for Windows? In this article, I will talk about five alternatives to the sudo command for Windows users.

Note : some of these tools are quite old now, so they may not work with the latest versions of Windows.

Windows Runas command

Windows has the command runas, which is the direct counterpart of sudo on Linux. Using the runas command, you can run a script, program, or command as a different user or as an administrator. The complete syntax for the runas command:

 runas (/ profile) (/ env) (/ netonly) (/ smartcard) (/ showtrustlevels) (/ trustlevel) / user: programma UserAccountName 

If you want to open an administrative command prompt, you can type the following:

 runas / noprofile / utente: amministratore cmd 

/ noprofile will not load the current user profile. You can remove it if you need to access the user's environment variables. If you want to open a text file using Notepad with administrator privileges, you can use this command:

 runas / utente: amministratore "notepad my_file.txt" 

You can check the Technet page on runas for more information on how to use it.

Note that when using the runas command, if you install a program or make changes to settings, etc., the changes will be made to the user account on which you are running the command. For example, suppose we have user X as a normal user and user Y as an administrator. If you log in to X and then run a runas using administrator credentials, the changes will be made to the administrator settings, not to user X.

Therefore, if you install an application by right-clicking the EXE file and choosing Run as administrator, it will be installed in the built-in Administrator user profile, not the one you are logged in to. If you want real elevated privileges as a sudo with no profile issues, check out the next alternative below.

Sudo for Windows – Sourceforge

Sudo for Windows is a free program that you can install that will give you the same experience as the sudo command on Linux for Windows. The only difference is that Sudo for Windows "preserve user profile and ownership of created objects" as stated by the developer. This is really useful if you want to use high permissions for installing apps or making changes to user locations like Docs, etc.

It will give you administrative privileges, but will keep all changes in the current profile instead of the account you are using to run the command with. The program requires .NET version 2.0, which cannot be downloaded individually. To get 2.0, you need to install the .NET Framework 3.5, which includes 2.0.

Once Sudo for Windows is installed, user accounts must be added to allow elevated privileges to a specific group created by the program named S udoers . Right-click on My Computer or This PC and click Manage . Then expand Users and groups and click Groups . You should see one called sudoers .

Double click on sudoers and click the button add .

In the next dialog, click on the button advanced and then click Find . This will list all users and groups on the system. Double-click on the user you want to add.

Repeat this step for all users you wish to add. Then click OK and you should see the members listed in the list box Members shown above. Click OK and now you should be able to use the GUI and the sudo command. If you right-click on a program, you will see the option Sudo .

You can also open a command prompt and type sudo to run the command with elevated permissions.

Overall, quite elegant and works very well. However, note that this particular program is really useful for to boot programs or processes via the right mouse button or via the command prompt, but not intended for running applications from the command line. For example, if you want to run sudo mkdir "c: Program Files new", it won't work with Sudo for Windows. For that feature, there is another program called the same thing, but by a different developer. Read below.

Sudo for Windows – Luke Sampson

There is another developer who has written another Sudo for Windows that also allows you to run command line applications. So let's go back to the example on creating a new folder in C: Program Files. You can't really do this by default.

Above I am using PowerShell, but you will also get the same error using the command prompt. However, once Sudo for Windows is installed, add the word sudo to the beginning of the command and it works perfectly without errors!

To install it, you need to open PowerShell and then type the following commands in order:

 iex (new-object net.webclient) .downloadstring ('//') set-executionpolicy unrestricted -s cu -f scoop install sudo 

If everything works correctly, you should see the following output in PowerShell after each command:

This is all! Now you can start typing commands and add sudo to the foreground. The only annoying thing about this program is that the User Account Control window still appears and you click S to make it work. Even with that slight annoyance, it's worth it.


Elevate a program that works with UAC and doesn't work exactly like sudo. With Elevate, I will change the user running in Administrator as the runas command does. However, useful for working on the command line or with batch files.

The main purpose of elevating is not to circumvent the UAC, but to start a process in an elevated state from a non-elevated shell and therefore continue normally even after the completion of the command. High useful for scripting because you don't have to worry about trying to run scripts in the entire right-click and running a command prompt as an Administrator process.

Elevation PowerToys for Windows

For those of you who work a lot on the command line or work with scripts and batch files, the Elevation PowerToys for Windows page has some useful tools and scripts.

Power elevation script toys were created to overcome the frustrating aspects of user account control when trying to elevate a program from the command line or run scripts as administrators.

Hopefully enough tools and programs are enough to make you feel like you're using sudo on Windows. There isn't a perfect substitute for this, but there are a few options that come close. If you use something else to elevate programs, commands or scripts in Windows, let us know in the comments. To enjoy!