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:
Open Settings and go to System > Advanced.
Find Enable sudo and turn it On.
If Windows asks for permission, approve the prompt.
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.