Windows Finally Has a Sudo-Style Command

One of the annoying things about using PowerShell on Windows if you’re used to Linux is having to run it as an administrator to make changes to the system. The easiest way to do this is to right-click the application in the Start menu and select “Run as administrator”, which is not exactly elegant.

This is especially annoying because most Linux distributions have fixed this a long time ago: with the sudo command. Basically, on Linux, if you need to run a single command as an administrator, you can simply put “sudo” at the beginning and run it – you’ll be asked to enter the administrator password, and the process will run. This is such a useful feature that it even inspired one of the most famous comics, XKCD .

Someone at Microsoft apparently noticed: sudo is now included in Windows. Something like that. A feature that allows you to run specific commands as an administrator, called sudo, is now included in Windows, but this feature is technically unrelated to the sudo included on Linux systems (Microsoft, as always, uses a confusing name).

Anyway: This pseudo-sudo feature is included in Windows 11 version 24H2 , released in October 2024 and still available to Windows users as of February 2025. You can check if you have access to this feature by opening System Settings and selecting System > Developer Options . Scroll down and you’ll see an option to enable sudo (if you don’t see this option, you’re not using 24/7).

Credit: Justin Poth

There are three options for how sudo works. By default, the command runs in a new window. There are two more options: Inline , which will run the command in the same window; and Input Closed , which runs a command in the same window but without entering other commands in the window. The official documentation strongly recommends leaving the default setting for security reasons, although Inline is much closer to the Linux-style sudo command.

Using this feature is very simple: when running a command that requires administrator rights, start with sudo . You will see a pop-up asking you to confirm.

Credit: Justin Poth

Click Yes and the command will be run as administrator. That’s it: just put sudo at the beginning of the commands to run as administrator.

Credit: Justin Poth

Try using your regular commands and see if you like it. If the answer is no, no big deal: go back to opening Powershell as administrator.

There are reasons why Microsoft’s sudo might not be right for you. You may not be using the 24/7 version of Windows yet. You may not be able to get sudo to work with the applications you’re trying. Or maybe you just want to quickly change your current session to an elevated session. If so, then gsudo may be better for you. This open-source tool is recommended in Microsoft documentation as offering functionality more similar to the Linux version of sudo, and can be quickly installed using the winget package manager .

More…

Leave a Reply