Skip to main content
deleted 203 characters in body
Source Link

I wrote gsudo, a sudo for windows that feels like *nix sudo and has a few killer features:

  • Run within the current console (attached) without breaking tab-key auto-complete. Or add -n to launch in a new window.
  • Handles all scenarios reliably to be used on scripts. (ExitCodes, StdIn/Out/Err Redirection/Capture)
  • Supports Cmd/PowerShell/PowerShell Core
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.

gsudo demo

Usage

gsudo Opens an elevated shell in the current console.

gsudo [options] {command} [arguments] Executes the specified command with elevated permissions.

Most relevant [options]:

  • -n | --new Starts the command in a new console with elevated rights (and returns immediately).
  • -w | --wait Force wait for the process to end (and return the exitcode).
  • -s | --system Run As Local System account ("NT AUTHORITY\SYSTEM").
  • --copyev Copy all environment variables to the elevated session before executing.

Installation

  • Using Scoop: scoop install gsudo
  • Using Chocolatey: choco install gsudo
  • Manual InstallUsing Winget: winget install gsudo
PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"

I wrote gsudo, a sudo for windows that feels like *nix sudo and has a few killer features:

  • Run within the current console (attached) without breaking tab-key auto-complete. Or add -n to launch in a new window.
  • Handles all scenarios reliably to be used on scripts. (ExitCodes, StdIn/Out/Err Redirection/Capture)
  • Supports Cmd/PowerShell/PowerShell Core
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.

gsudo demo

Usage

gsudo Opens an elevated shell in the current console.

gsudo [options] {command} [arguments] Executes the specified command with elevated permissions.

Most relevant [options]:

  • -n | --new Starts the command in a new console with elevated rights (and returns immediately).
  • -w | --wait Force wait for the process to end (and return the exitcode).
  • -s | --system Run As Local System account ("NT AUTHORITY\SYSTEM").
  • --copyev Copy all environment variables to the elevated session before executing.

Installation

  • Using Scoop: scoop install gsudo
  • Using Chocolatey: choco install gsudo
  • Manual Install
PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"

I wrote gsudo, a sudo for windows that feels like *nix sudo and has a few killer features:

  • Run within the current console (attached) without breaking tab-key auto-complete. Or add -n to launch in a new window.
  • Handles all scenarios reliably to be used on scripts. (ExitCodes, StdIn/Out/Err Redirection/Capture)
  • Supports Cmd/PowerShell/PowerShell Core
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.

gsudo demo

Usage

gsudo Opens an elevated shell in the current console.

gsudo [options] {command} [arguments] Executes the specified command with elevated permissions.

Most relevant [options]:

  • -n | --new Starts the command in a new console with elevated rights (and returns immediately).
  • -w | --wait Force wait for the process to end (and return the exitcode).
  • -s | --system Run As Local System account ("NT AUTHORITY\SYSTEM").

Installation

  • Using Scoop: scoop install gsudo
  • Using Chocolatey: choco install gsudo
  • Using Winget: winget install gsudo
  • Or check the docs and latest release
Updated installation info
Source Link

gsudo

All the answers explain how to elevate your command in aI wrote newgsudo console host but none of those tools behave, a sudo for windows that feels like *nix sudo, allowing to execute the command inside the current console.

So I wrote: gsudo: with two key focus: Same user experience as *nix sudo, and handle all scenarios to be used reliable on scripts.

Source Codehas a few killer features: https://github.com/gerardog/gsudo

#Features

  • Elevated commands are shown inRun within the user-levelcurrent console, as (attached) without breaking tab-key auto-complete. Or add *nix sudo-n does, instead of opening the commandto launch in a new window.
  • Handles all scenarios reliably to be used on scripts. (ExitCodes, StdIn/Out/Err Redirection/Capture)
  • Supports Cmd/PowerShell/PowerShell Core
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.

gsudo demo

Usage

gsudo Opens an elevated shell in the current console.

gsudo [options] {command} [arguments] Executes the specified command with elevated permissions.

Most relevant [options]:

  • Suport for CMD commands:-n | --new Starts the command in a gsudo md foldernew console with elevated rights (no need to useand returns immediately).
  • -w | --wait Force wait for the longer formprocess to end gsudo cmd.exe /c md folder(and return the exitcode).
  • Suport for PowerShell commands if invoked from a PS shell-s | --system Run As Local System account ("NT AUTHORITY\SYSTEM").
  • Scripting:
    • gsudo can be used on scripts that requires to elevate one or more commands. (the UAC popup will appear once).
    • Outputs and exit codes of the elevated commands can be interpreted: E.g. StdOutbound can be piped or captured (gsudo dir | findstr /c:"bytes free" > FreeSpace.txt) and exit codes too ('%errorlevel%)).
    • If gsudo is invoked (with params) from an already elevated console it will just run the commands. So if you invoke a script that uses gsudo from an already elevated console, it will also work. The UAC popup would not appear.
    --copyev Copy all environment variables to the elevated session before executing.

Installation

Via scoop (preferred method)

  • Install scoop (if you don't already have it)

    Using Scoop: scoop install gsudo
  • scoop install gsudo.json

    Using Chocolatey: choco install gsudo
  • Manual Install

Or via Chocolatey

chocoPowerShell install-Command gsudo"Set-ExecutionPolicy RemoteSigned -scope Process; iwr -version=0useb https://raw.5githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"

gsudo demo

gsudo

All the answers explain how to elevate your command in a new console host but none of those tools behave like *nix sudo, allowing to execute the command inside the current console.

So I wrote: gsudo: with two key focus: Same user experience as *nix sudo, and handle all scenarios to be used reliable on scripts.

Source Code: https://github.com/gerardog/gsudo

#Features

  • Elevated commands are shown in the user-level console, as *nix sudo does, instead of opening the command in a new window.
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.
  • Suport for CMD commands: gsudo md folder (no need to use the longer form gsudo cmd.exe /c md folder
  • Suport for PowerShell commands if invoked from a PS shell.
  • Scripting:
    • gsudo can be used on scripts that requires to elevate one or more commands. (the UAC popup will appear once).
    • Outputs and exit codes of the elevated commands can be interpreted: E.g. StdOutbound can be piped or captured (gsudo dir | findstr /c:"bytes free" > FreeSpace.txt) and exit codes too ('%errorlevel%)).
    • If gsudo is invoked (with params) from an already elevated console it will just run the commands. So if you invoke a script that uses gsudo from an already elevated console, it will also work. The UAC popup would not appear.

Installation

Via scoop (preferred method)

  • Install scoop (if you don't already have it)

  • scoop install gsudo.json

Or via Chocolatey

choco install gsudo --version=0.5

gsudo demo

I wrote gsudo, a sudo for windows that feels like *nix sudo and has a few killer features:

  • Run within the current console (attached) without breaking tab-key auto-complete. Or add -n to launch in a new window.
  • Handles all scenarios reliably to be used on scripts. (ExitCodes, StdIn/Out/Err Redirection/Capture)
  • Supports Cmd/PowerShell/PowerShell Core
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.

gsudo demo

Usage

gsudo Opens an elevated shell in the current console.

gsudo [options] {command} [arguments] Executes the specified command with elevated permissions.

Most relevant [options]:

  • -n | --new Starts the command in a new console with elevated rights (and returns immediately).
  • -w | --wait Force wait for the process to end (and return the exitcode).
  • -s | --system Run As Local System account ("NT AUTHORITY\SYSTEM").
  • --copyev Copy all environment variables to the elevated session before executing.

Installation

  • Using Scoop: scoop install gsudo
  • Using Chocolatey: choco install gsudo
  • Manual Install
PowerShell -Command "Set-ExecutionPolicy RemoteSigned -scope Process; iwr -useb https://raw.githubusercontent.com/gerardog/gsudo/master/installgsudo.ps1 | iex"
updated with v5 info
Source Link

gsudo

All the answers explain how to elevate your command in a new console host.

What amused me was that but none of those tools behave like *nix sudo, allowing to execute the command inside the current console.

So I wrote my own: gsudo: with two key focus: Same user experience as *nix sudo, and handle all scenarios to be used reliable on scripts.

Source Code: https://github.com/gerardog/gsudo

#Installation#Features

  • Elevated commands are shown in the user-level console, as *nix sudo does, instead of opening the command in a new window.
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.
  • Suport for CMD commands: gsudo md folder (no need to use the longer form gsudo cmd.exe /c md folder
  • Suport for PowerShell commands if invoked from a PS shell.
  • Scripting:
    • gsudo can be used on scripts that requires to elevate one or more commands. (the UAC popup will appear once).
    • Outputs and exit codes of the elevated commands can be interpreted: E.g. StdOutbound can be piped or captured (gsudo dir | findstr /c:"bytes free" > FreeSpace.txt) and exit codes too ('%errorlevel%)).
    • If gsudo is invoked (with params) from an already elevated console it will just run the commands. So if you invoke a script that uses gsudo from an already elevated console, it will also work. The UAC popup would not appear.

Installation

Via scoop (preferred method)

  • Install scoop (if you don't already have it)

  • Install gsudo scoop install gsudo.json

scoop install https://raw.githubusercontent.com/gerardog/gsudo/master/src/scoop-package/gsudo.json

Or via Chocolatey

choco install gsudo --version=0.4.15

Or download the latest release, unzip, and add to path, from https://github.com/gerardog/gsudo/releases/

gsudo demo

All the answers explain how to elevate your command in a new console host.

What amused me was that none of those tools behave like *nix sudo, allowing to execute the command inside the current console.

So I wrote my own: gsudo

Source Code https://github.com/gerardog/gsudo

#Installation

Via scoop (preferred method)

  • Install scoop (if you don't already have it)

  • Install gsudo

scoop install https://raw.githubusercontent.com/gerardog/gsudo/master/src/scoop-package/gsudo.json

Or via Chocolatey

choco install gsudo --version=0.4.1

Or download the latest release, unzip, and add to path, from https://github.com/gerardog/gsudo/releases/

gsudo demo

gsudo

All the answers explain how to elevate your command in a new console host but none of those tools behave like *nix sudo, allowing to execute the command inside the current console.

So I wrote: gsudo: with two key focus: Same user experience as *nix sudo, and handle all scenarios to be used reliable on scripts.

Source Code: https://github.com/gerardog/gsudo

#Features

  • Elevated commands are shown in the user-level console, as *nix sudo does, instead of opening the command in a new window.
  • Credentials cache: If gsudo is invoked several times within minutes it only shows the UAC pop-up once.
  • Suport for CMD commands: gsudo md folder (no need to use the longer form gsudo cmd.exe /c md folder
  • Suport for PowerShell commands if invoked from a PS shell.
  • Scripting:
    • gsudo can be used on scripts that requires to elevate one or more commands. (the UAC popup will appear once).
    • Outputs and exit codes of the elevated commands can be interpreted: E.g. StdOutbound can be piped or captured (gsudo dir | findstr /c:"bytes free" > FreeSpace.txt) and exit codes too ('%errorlevel%)).
    • If gsudo is invoked (with params) from an already elevated console it will just run the commands. So if you invoke a script that uses gsudo from an already elevated console, it will also work. The UAC popup would not appear.

Installation

Via scoop (preferred method)

  • Install scoop (if you don't already have it)

  • scoop install gsudo.json

Or via Chocolatey

choco install gsudo --version=0.5

gsudo demo

added 361 characters in body
Source Link
Loading
Source Link
Loading