Skip to content

How-ToOS

How to Enable and Use Sudo in Windows 11

How to enable and use Sudo for Windows in Windows 11 24H2 and later: turn it on in Settings > System > Advanced, choose between the new window, input closed and inline modes, run admin commands with sudo, and how it compares with runas.

By , Systems & Technical Editor

4 min read

How to Enable and Use Sudo in Windows 11

The steps and settings below come from Microsoft's Sudo for Windows documentation, read on 24 November 2026, plus our existing Windows guides.

If you've ever typed a command such as sfc /scannow into a normal terminal, been told you need administrator rights, then had to close the window and open an admin terminal, Sudo for Windows is for you. Microsoft describes it as a way to run elevated commands, as an administrator, directly from an unelevated console session. Linux and macOS users will recognise the idea, and on Windows 11 it's built in and free.

What you need

Microsoft says the sudo command is available in Windows 11 version 24H2 or later. If you're not sure which version you have, open Settings > System > About and look under Windows specifications, or see our guide to updating to Windows 11 26H2. Sudo isn't available in Windows 10.

You also need an account that can approve administrator prompts. Sudo doesn't bypass User Account Control (UAC): Microsoft says it can only elevate via the UAC prompt, so you'll still see the usual "Do you want to allow this app to make changes" box each time.

How to turn on sudo

If sudo isn't already switched on, here's how to enable it:

  1. Open Settings and go to System > Advanced.

  2. Find Enable sudo and turn it On.

  3. If Windows asks for permission, approve the prompt.

  4. Below the switch, choose how sudo should run (see the next section). If you're unsure, leave it on the default, In a new window.

Sudo is a console command, so you use it from a Command Prompt or PowerShell session, including inside Windows Terminal.

The three sudo modes explained

Microsoft offers three configurations. They change where the elevated command runs and whether it can receive your typing.

Mode in Settings

Config name

What happens

Security trade-off

In a new window

forceNewWindow

The elevated command opens in a separate window, much like runas /user:admin

Default; Microsoft recommends it unless you understand the risks of the others

Input closed

disableInput

Runs in your current window, but the elevated process can't receive input from it

Mitigates some risk by closing the input handle

Inline

normal

Runs in your current window and can take input, closest to sudo on Linux

Most convenient, but an unelevated process could send input to the elevated one

Microsoft's security notes explain why this matters. In the Input closed and Inline modes there's a connection between the unelevated sudo process and the elevated one, and a malicious process could try to drive the elevated process through it. Closing the input handle in disableInput mode removes that path, while Inline mode leaves it open, and an unelevated process in the same window can also read the output. For most home PCs, the default new-window mode is the safest choice; Inline is handy if you're comfortable with the trade-off and want a Linux-like workflow.

You can also change the mode from an elevated terminal with:

sudo config --enable forceNewWindow

Replace forceNewWindow with disableInput or normal to switch to the other modes.

How to use sudo

Put sudo in front of the command you want to run as administrator. Microsoft's own example is sudo netstat -ab, which lists network connections together with the programs that own them, something that needs admin rights. A UAC prompt appears, and once you approve it the command runs elevated.

Some everyday PC maintenance commands that need administrator rights and work well with sudo:

  • sudo sfc /scannow to check Windows system files (our DISM and SFC guide explains what the results mean).

  • sudo chkdsk C: /scan to scan the system drive for file system errors online (see our CHKDSK guide).

  • sudo notepad C:\Windows\System32\drivers\etc\hosts to edit the hosts file, one of Microsoft's examples.

  • sudo diskpart to open the disk partitioning tool, another Microsoft example. Take care: diskpart can wipe drives.

Microsoft adds a sensible warning: use sudo only when elevated permissions are really necessary. If a command works without it, run it without it.

Sudo vs runas vs an admin terminal

Windows already had ways to elevate, so where does sudo fit?

  • Admin terminal: right-click Windows Terminal and choose Run as administrator. Everything in that window runs elevated, which is convenient for long admin sessions but means every command has full rights.

  • runas: Microsoft says runas can run programs as any user, not just an administrator, and can prompt for a password at the command line. Sudo can't yet run commands as other users; Microsoft says that's on its roadmap.

  • sudo: elevates one command at a time from your normal window, and in the Input closed or Inline modes keeps the output in the same window, which runas can't do.

If you need more features, Microsoft points to gsudo, a separate open-source tool by Gerardo Grignoli with extra options. Sudo for Windows itself is open source, with its code published in Microsoft's GitHub repository.

How to turn sudo off

Go back to Settings > System > Advanced and switch Enable sudo off. If you only enabled it to try it out, turning it off removes the elevation path Microsoft flags as a potential escalation-of-privilege vector in some configurations.

Our verdict

Sudo for Windows is a small but genuinely useful Windows 11 24H2 and later feature for anyone who regularly runs admin commands such as SFC, CHKDSK or diskpart. Turn it on in Settings > System > Advanced, keep the default In a new window mode unless you understand the risks of Input closed and Inline, and put sudo in front of a command only when it really needs administrator rights. It still goes through UAC, so it adds convenience without skipping Windows' security prompt.

The bottom line

Sudo for Windows is a small but genuinely useful Windows 11 24H2 and later feature for anyone who regularly runs admin commands such as SFC, CHKDSK or diskpart. Turn it on in Settings > System > Advanced, keep the default In a new window mode unless you understand the risks of Input closed and Inline, and put sudo in front of a command only when it really needs administrator rights. It still goes through UAC, so it adds convenience without skipping Windows' security prompt.

Sources

  1. 01Microsoft Learn, Sudo for Windows
  2. 02Microsoft, Sudo for Windows repository on GitHub

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

SGLang vs vLLM: Which LLM Serving Engine Should You Run on Your PC?

Versus

SGLang vs vLLM: Which LLM Serving Engine Should You Run on Your PC?

SGLang vs vLLM for a local AI server: both are fast, open-source LLM serving engines with OpenAI-compatible APIs that run on Linux. vLLM supports more home hardware, including AMD Radeon RX 7900 and RX 9000 cards, while SGLang suits recent NVIDIA RTX cards and agent-heavy workloads.

Callum Reid6 min

ComfyUI vs AUTOMATIC1111: Which Local AI Image Generator Should You Use in 2026?

Versus

ComfyUI vs AUTOMATIC1111: Which Local AI Image Generator Should You Use in 2026?

ComfyUI vs AUTOMATIC1111 in late 2026: ComfyUI is actively developed (v0.46.0 on 18 November 2026), supports Flux.2, Qwen Image and video models and has a desktop installer. A1111's web UI hasn't had a release since v1.10.1 in February 2025, so it only makes sense if you already have a working SD 1.5 or SDXL setup.

Callum Reid6 min