logo
Windows 11 Enable and Use Windows 11 Sudo Command

How to Enable and Use Windows 11 Sudo Command?

By Lydia | Last Updated

In Windows 11 version 24H2, Microsoft introduced a Sudo command similar to Linux Sudo. Here is detailed introduction of Windows Sudo, including ways to enable and use Windows 11 Sudo command.

Enable and Use Windows 11 Sudo Command

Part 1: Is Sudo for Windows Available Now?

Sudo for Windows is currently only available to users running Windows Insider Preview builds or higher. Other users who wish to use it need to register to join the Windows Insider program. You can find it on Windows 11 Canary builds and it may be progressively rolled out to stable builds throughout the year.

Part 2: What can Windows Sudo Command do?

The term "sudo" stands for "superuser do", allowing regular users to execute commands with superuser privileges on specific commands. To be simplified, it enables non-root users to run commands that typically require root privileges.

It speeds up administrative tasks, and primarily achieves the following:

1. Execute commands as another user without needing to log into their account.

2. Provide a more secure method to grant users elevated access.

3. Spend less time writing runas commands.

Part 3: How to Enable sudo in Windows 11?

To enable sudo in Windows 11 via Settings:

Step 1: Open Settings > System > For developer.

Step 2: Turn on "Developer Mode" and then confirm to use developer features.

Turn on Developer Mode

Confirm to Use Developer Features

Step 3: Enable the "Enable sudo" option under the Developer options.

Enabled Sudo from Settings

Step 4: Once configured, you can use sudo in both the regular command prompt and PowerShell to execute operations that require administrator privileges.

To enable via command line:

Steps: Right-click on Windows, choose Terminal. Run the following command:

sudo config --enable <configuration_option>

CMD Enable Sudo Windows 11

You can replace "<configuration_option>" with "forceNewWindow", "disableInput", or "normal" based on your preferences.

Part 4: Sudo Configurations for Running Command on Windows

On the "Developer settings" interface, there are 3 options for configuring sudo command behavior:

Sudo Configurations

1. In a new window: When using sudo to run commands, it opens a new window with administrator privileges and executes the command there.

2. With input disabled: A security feature where when running sudo commands, the command executes in a new window and does not accept additional input. This temporarily disables keyboard or mouse input to prevent unauthorized actions during execution.

3. Inline: Allows sudo commands to execute in the current window or relevant context, similar to Linux and macOS.

Part 5: How to Use the sudo Command in Windows?

To run commands with administrative privileges using the sudo command in Windows, simply type "sudo" in the command.

Take following command as example, it fails if executed without "sudo" because it is only available to users in an elevated administrative session.

sudo del mytextfile.txt

How Use Sudo Command Windows 11

You can also achieve similar functionality by using PowerShell or Command Prompt with administrative privileges, and by creating a shortcut that allows standard users to run applications as administrators, speeding up administrative tasks in Windows.

Part 6: Windows 11 sudo options

Windows 11 currently only has few options for sudo now, whereas Linux has around 20. Using the command below to check the options:

sudo -h

Windows 1 Sudo Help