Skip to content

Instantly share code, notes, and snippets.

@malkia
Created January 22, 2024 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malkia/768683a52baf41fba318535ca34877ba to your computer and use it in GitHub Desktop.
Save malkia/768683a52baf41fba318535ca34877ba to your computer and use it in GitHub Desktop.
restart batch file with admin rights
net sessions 1>nul 2>nul || (
rem Restart with admin rights the same script
PowerShell "Start-Process -FilePath '%0' -Verb RunAs -ArgumentList wait"
exit %ERRORLEVEL%
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment