Skip to content

Instantly share code, notes, and snippets.

@litodam
Created April 26, 2012 18:30
Show Gist options
  • Save litodam/2501695 to your computer and use it in GitHub Desktop.
Save litodam/2501695 to your computer and use it in GitHub Desktop.
Batch CMD file starting point (with check for elevation)
@echo off
setlocal
CD /d "%~dp0"
::Test If script has Admin Privileges/is elevated
REG QUERY "HKU\S-1-5-19"
IF %ERRORLEVEL% NEQ 0 (
ECHO Please run this script as an administrator
pause
EXIT /B 1
)
cls
REM Do something that requires elevation here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment