5000+ Great Articles

5 Windows Alternatives to the Linux sudo Command

If you’ve ever used Linux, or know someone who uses Linux, then you’ve probably heard of the sudo command. The command is an essential component for almost every Linux distribution, and it allows you to run a command as a different user, primarily the root user. On some Linux distributions, you can log in as root using the su command, but this is considered very risky and no one ever does.

In fact, it is so dangerous that it is disabled by default on Linux distributions like Ubuntu. Instead, you must use the sudo command if you want to run the command as root. So what about Windows? Unfortunately, most people log on to Windows as administrators, which is the same as root on Linux. However, Microsoft has tried to mitigate the harmful effects of logging in as an administrator by enabling User Account Control or UAC.

Thus, even if the user has administrator rights, applications running under this account will not inherit these privileges unless manually allowed by the user. This helps prevent malware and spyware infections for a Windows user who is logged on as an administrator.

So if Linux users have a sudo command, what does a Windows user have? Are there alternatives that Windows users can use to execute commands with elevated privileges? Is there a sudo command for Windows? In this article, I will introduce five alternatives to the sudo command for Windows users.

Note. Some of these tools are already outdated, so they may or may not work with the latest versions of Windows.

Windows Runas command

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

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

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

runas / noprofile / user: Administrator cmd

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

runas / user: Administrator “notepad my_file.txt”

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

Note that when using the runas command, if you install the program or make changes to settings, etc., the changes will be made to the user account where you run the command. For example, suppose you have user X, who is a regular user, and user Y, who is an administrator. If you sign in to X and then run using your administrator credentials, the changes will be made to the administrator settings, not user X.

Therefore, if you install the application by right-clicking the EXE file and choosing Run as Administrator, it will be installed in the built-in administrator profile, not the one you are logged into. If you want truly elevated privileges like sudo without profile issues, check out the next alternative below.

Sudo for Windows – Sourceforge

Sudo for Windows is a free program that you can install that gives you the same capabilities as the Linux sudo command for Windows. The only difference is that Sudo for Windows “preserves the user profile and ownership of the created objects” as stated by the developer. This is really handy if you like to use elevated permissions to install apps or make changes to custom locations like My Documents, etc.

It will give you administrator rights, but it will save all changes to your current profile, not to the account you use to run the command. The program requires .NET version 2.0, which you cannot download separately. To get version 2.0, you need to install .NET Framework 3.5, which includes 2.0.

After installing Sudo for Windows, you need to add the user accounts that you allow elevated privileges to a specific group created by Sudoers. Right-click “My Computer” or “This PC” and select “Manage”. Then expand Users and Groups and click Groups. You should see one called Sudoers.

Double click Sudoers and click the Add button.

In the next dialog box, click the Advanced button and then click Find Now. It will list all users and groups on the system. Double click the user you want to add.

Repeat this step for as many users as you want to add. Then click OK and you should see the attendees listed in the attendee list shown above. Click OK and you should now be able to use the sudo GUI and command. If you right-click the program, you will see the Sudo option.

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

Overall, it is pretty good and works very well. Note, however, that this particular program is indeed useful for launch programs or processes by right-clicking or via the command line, but it is not intended to launch command line applications. For example, if you want to run sudo mkdir “c: Program Files new”, it will not work with Sudo for Windows There is another program for this functionality with the same name, but from a different developer. Read below.

Sudo for Windows – Luke Sampson

Another developer wrote another Sudo for Windows that also allows you to run applications from the command line. So let’s go back to the example about creating a new folder in C: Program Files. This is not possible by default.

I am using PowerShell above, but you will get the same error on the command line as well. However, after installing Sudo for Windows, just add the word sudo to the beginning of the command and it will work without error!

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

iex (new-object net.webclient) .downloadstring (‘https://get.scoop.sh’) set-executionpolicy unrestricted -s cu -f scoop install sudo

If everything is working fine, you should see the following output in PowerShell after each command:

This is it! You can now start typing commands and add sudo in front. The only annoying thing about this program is that the UAC window still appears and you click Yes for it to work. Even with this slight annoyance, the benefit is worth it.


Elevate is a program that works with UAC and works differently from sudo. With Elevate, it will change the executing user to admin as the runas command does. However, this is useful for working on the command line or batch files.

The main purpose of the promotion is not to bypass UAC, but to start the elevated process from a non-elevated shell, and then continue as usual even after the command has finished. Elevate is useful for scripting because you don’t have to worry about trying to write a script by right clicking and running Command Prompt as administrator.

Lifting PowerToys for Windows

For those of you with a lot of command line work or scripting and batch files, the Elevation PowerToys for Windows page has quite a few helpful tools and scripts.

The elevation scripts were created to overcome the frustrating aspects of UAC when trying to elevate a program from the command line or when running scripts as an administrator.

Hopefully this is enough tools and programs to make you feel like you are actually using sudo on Windows. There is no perfect replacement for it, but there are quite a few suitable options. If you are using anything else to improve programs, commands or scripts on Windows, let us know in the comments. Enjoy!

Exit mobile version