mirror of
https://github.com/gerardog/gsudo.git
synced 2025-01-07 03:06:40 +08:00
.. | ||
many-elevations-using-gsudo-cache.cmd | ||
many-elevations-using-gsudo-cache.ps1 | ||
readme.md | ||
self-elevate-one-liner.cmd | ||
self-elevate-without-gsudo.cmd | ||
self-elevate.cmd | ||
self-elevate.ps1 | ||
silent-elevation-one-liner.cmd | ||
silent-elevation.cmd |
gsudo Sample Scripts
This folder contains sample scripts demonstrating how to use gsudo
to elevate privileges on a Windows machine. The provided scripts include:
-
Script Self-Elevation: A technique to ensure that the current script is running elevated, by detecting when it is not, and elevating itself. More details can be found in the gsudo documentation on script self-elevation.
self-elevate.cmd
: Batch script versionself-elevate-one-liner.cmd
: A one-liner version of the batch script.self-elevate.ps1
: PowerShell version.self-elevate-without-gsudo.cmd
: Example without usinggsudo
.
-
Many Elevations Using gsudo Cache:
many-elevations-using-gsudo-cache.cmd
: Batch script versionmany-elevations-using-gsudo-cache.ps1
: PowerShell version
-
Don't show an UAC pop-up: Perform an elevated admin task if and only if it can be done without an interactive UAC pop-up. (i.e. when already elevated or gsudo cache is active)
silent-elevation-one-liner.cmd
: A one-liner version.silent-elevation.cmd
: Verbose version .
These scripts are examples and should be used with caution. Always review and understand the code you are executing on your system.