Windows 11 includes a built-in sudo command that lets you run an individual command with administrator privileges from a terminal that is not already elevated. It is available in Windows 11 version 24H2 and later.
On current versions of Windows 11, you can enable sudo under Settings > System > Advanced. On Windows 11 24H2, the setting may still appear under Settings > System > For developers. After you choose how sudo should run elevated commands, type sudo before the command you want to run as an administrator.
Check whether your PC supports sudo
Sudo for Windows requires Windows 11 version 24H2 or later. It is not available as a built-in feature in Windows 10 or older Windows 11 releases.
- Press Windows + R.
- Type
winver. - Press Enter.
- Check the Windows version shown in the About Windows window.
If the version is older than 24H2, install the Windows updates available for the PC before looking for the sudo setting.
Windows sudo is also separate from the sudo command you may use inside Windows Subsystem for Linux. The Windows version runs Windows commands with elevated Windows privileges.
Enable sudo from Windows Settings
- Open Settings.
- Select System.
- On current Windows 11 releases, open Advanced. If you are using Windows 11 24H2 and do not see that page, open For developers instead.
- Find Enable sudo and turn it on.
- Approve the User Account Control prompt if one appears.
- Choose how sudo should run elevated commands.
Microsoft moved the former For developers settings to the Advanced page in newer Windows 11 releases. If the option is not where you expect it, use the Settings search box and search for sudo.
Choosing a sudo mode
Windows provides three operating modes.
- In a new window: Opens the elevated command in a separate console window. This provides the clearest separation between the normal terminal and the administrator process.
- Input closed: Runs the command in the current window but prevents the elevated process from receiving input. Do not use this mode for a program that needs you to type a response.
- Inline: Runs the elevated process in the current terminal and allows interaction with it. It feels the most like Linux sudo, but it also provides less isolation between the unelevated terminal and the elevated process.
If you are unsure which mode to use, In a new window is the most isolated choice. Microsoft notes additional security considerations for Input closed and Inline because the unelevated and elevated sudo processes communicate with each other.
Enable or change sudo from the command line
You can also configure sudo from an elevated terminal. Open Windows Terminal, PowerShell, or Command Prompt as an administrator, then use the command for the mode you want.
For In a new window:
sudo config --enable forceNewWindow
For Input closed:
sudo config --enable disableInput
For Inline:
sudo config --enable normal
You need administrator privileges to change the sudo configuration. Once sudo is enabled, however, you can use it from an ordinary terminal when you need to elevate a particular command.
Run a command with sudo
The basic syntax is:
sudo <command>
For example, to flush the DNS resolver cache, you can enter:
sudo ipconfig /flushdns
Windows may display a User Account Control prompt. Approve it to allow the command to run with administrator privileges.
Only the process started through sudo is elevated. The terminal session you started from does not become an administrator terminal.
For example, you could launch Notepad with administrator privileges to edit the Windows hosts file:
sudo notepad C:\Windows\System32\drivers\etc\hosts
The exact behavior you see after entering the command depends on the sudo mode you selected.
Commands that need special handling
Changing folders
A command such as:
sudo cd C:\Windows
does not change the working directory of your original terminal. The elevated command runs in another process, so a directory change there cannot change the state of the shell you started from.
If you simply need to work in another directory, use cd normally and apply sudo only to the command that actually needs administrator privileges.
Output redirection
Shell operators such as > can also cause confusion because the shell may process the redirection before the elevated program runs.
For example, when writing to a protected location, you may need to run the shell itself through sudo:
sudo cmd /c "echo Example > C:\protected-folder\file.txt"
Be careful with commands that write to protected system locations. Administrator privileges can modify files and settings that affect Windows.
If sudo isn’t working
If you do not see Enable sudo, confirm that the PC is running Windows 11 version 24H2 or later. On newer releases, check Settings > System > Advanced. On 24H2, also check Settings > System > For developers.
If Windows says sudo is not recognized, check the Windows version and install current Windows updates. Opening a new terminal after updating can also help.
If a command needs keyboard input but will not accept it, check the sudo mode. Input closed deliberately prevents the elevated process from receiving input.
If you still receive an access-denied message, make sure the command itself is valid and that your account can approve an administrator elevation through User Account Control. Sudo does not bypass Windows security policy or give an account permissions it is not allowed to obtain.
Turn sudo off
- Open Settings > System > Advanced. On Windows 11 24H2, use Settings > System > For developers if the Advanced page is not present.
- Find Enable sudo.
- Turn the switch off.
You can also disable it from an elevated terminal with:
sudo config --disable
Disabling sudo does not remove PowerShell, Command Prompt, Windows Terminal, or the normal Run as administrator option. It only disables the built-in sudo command.

Matthew Burleigh has been writing tech tutorials since 2008. His writing has appeared on dozens of different websites and been read over 50 million times.
After receiving his Bachelor’s and Master’s degrees in Computer Science he spent several years working in IT management for small businesses. However, he now works full time writing content online and creating websites.
His main writing topics include iPhones, Microsoft Office, Google Apps, Android, and Photoshop, but he has also written about many other tech topics as well.