sudo !! equivalent on Windows cmd
You can try gsudo
, a sudo for windows that allows either to run commands with elevated permissions on the current console, to elevate the current shell, or launch elevated commands on a new console.
Examples
gsudo {command} [arguments]
gsudo md "C:\Program Files\MyApp"
# spawn the current shell (Cmd/PowerShell/PSCore) in a new console window
gsudo -n
# spawn PowerShell in a new console window
gsudo -n powershell
UPDATE:
Since gsudo v0.7.1
, it supports the Unix-sudo Bang Bang syntax, on CMD:
-
gsudo !!
elevates the last executed command. -
gsudo !prefix
elevates the last executed command that starts with prefix. -
gsudo !?infix
elevates the last executed command that contains infix.
Installation
- Install with Scoop:
scoop install gsudo
- Install with Chocolatey:
choco install gsudo
Manuall installation methods, docs & source at https://github.com/gerardog/gsudo