2 title: Sudo for Windows
3 homepage: https://stackoverflow.com/a/40321310/151312
5 Sudo for Windows gives you a minimal `sudo` that works in cmd.exe and PowerShell.
10 > Sudo for Windows isn't real `sudo`, but it's close enough for certain tasks -
11 > like installing WSL (the Windows Subsystem for Linux), without opening a GUI
12 > to Alt-Click "Run as Administrator".
14 ### Example: Enabling WSL
17 sudo.cmd dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
22 `sudo.cmd` is simply an alias of a powershell elevation command:
26 powershell -Command "Start-Process cmd -Verb RunAs -ArgumentList '/c cd /d %CD% && %*'"
30 Note: replace `/c` with `/k` if you'd like the window to stay open rather than
31 closing automatically.
33 Source: <https://stackoverflow.com/a/55643173/151312>