gsudo Guide: Elevate Privileges on Windows Like Linux sudo
gsudo: Windows’ sudo, Elevating Privileges Without That Damned Right-Click
One-sentence solution: Tired of opening a new administrator window every time you need to run a command that requires admin privileges? gsudo lets you just prefix your command with
gsudoin your current window.
If you’ve used Linux or Mac, you’re probably familiar with sudo — prefix your command with sudo, enter your password, and the command runs with admin privileges. Elegant, direct, one line.
Back on Windows? You want to run a command that needs admin privileges: Open a new terminal window → Right-click → “Run as administrator” → Confirm the UAC prompt → Navigate back to your target directory → Finally, you can type your command.
Every single time. Annoying, isn’t it?
What is gsudo?
gsudo is the sudo command for Windows — a small tool that lets you execute commands with administrator privileges directly in your current terminal window.
The core problem it solves: No more opening a separate admin terminal each time — elevate privileges right in your existing window.
How Satisfying Is It to Use?
Scenario 1: One Command to Elevate
gsudo net start SomeService
That simple. Just prefix with gsudo, and the following command runs as administrator. No new window, no re-navigating to the directory.
Scenario 2: Enter Admin Shell
If you need to run multiple admin commands in a row:
gsudo
After executing this, your current shell becomes admin mode, and all subsequent commands are automatically elevated. Type exit to return to normal mode.
Scenario 3: Pipes and Redirection
gsudo dir > "C:\Program Files\test.txt"
Even if the target folder requires admin privileges to write to, adding gsudo handles it.
Comparison with Similar Tools
| Feature | gsudo | Right-click “Run as admin” | sudo for Windows |
|---|---|---|---|
| Usage | Command prefix | Need new window | Command prefix |
| Keep current directory | Yes | No (goes to system32) | Yes |
| Pipe support | Yes | No | Limited |
| Credential caching | Configurable | UAC every time | Yes |
| Open source | Yes | No | Yes |
gsudo is the most mature sudo implementation currently available on Windows.
Pros and Cons Summary
Pros
- Simple to use — just add
gsudobefore your command - Keeps current working directory, no need to re-cd
- Supports pipes and redirection
- Caches credentials, no repeated UAC prompts for multiple elevations
- Open source and free
Cons
- Requires installation (unlike Linux’s built-in sudo)
- First use triggers a UAC prompt
- Occasionally has minor issues with very complex command chains
- Not useful for users who rarely use the command line
Download and Installation
Via Scoop (recommended)
scoop install gsudo
Via Chocolatey
choco install gsudo
Direct Download
- GitHub Releases: https://github.com/gerardog/gsudo/releases
- Download, extract, and add the directory to your PATH environment variable
Tip: Installing via a package manager is recommended for easier updates.
Quick Start
- After installation, open PowerShell or CMD
gsudo whoami /groups— Check your current privilegesgsudo netstat -ano— Run network statistics with admin privilegesgsudo— Enter admin mode, then execute multiple commands- Type
exitto leave elevation mode when done
Conclusion
gsudo is a “finally, it’s here” tool for every developer who uses the command line on Windows. It doesn’t solve some earth-shattering problem, but the few “right-click → Run as administrator” steps it saves you every day add up to real efficiency gains.
One-sentence summary: The sudo that Windows should have had all along.