]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Added admin privilege check
authorNoahAndrews <NoahAndrews@users.noreply.github.com>
Mon, 11 Apr 2016 18:30:15 +0000 (14:30 -0400)
committerNoahAndrews <NoahAndrews@users.noreply.github.com>
Mon, 11 Apr 2016 18:30:15 +0000 (14:30 -0400)
Running this as a non-administrator appears to work at first, but the
changes wouldn't stick on my Win 8.1 system.  It's weird, but this
script needs to run as admin.

1-setup-path-win.bat

index 6965f5bb95fc4f7df1059b748f218ceed07cbbe2..f612d0f4a7998ef60d00c32931a6310ec922a0a7 100644 (file)
@@ -5,6 +5,13 @@ SET CMDLINERUNSTR=%SystemRoot%\system32\cmd.exe
 SET NEWPATH1="C:\MinGW\msys\1.0\bin"
 SET NEWPATH2="C:\MinGW\bin"
 
+:: Make sure we're running with administrator privileges
+NET SESSION >nul 2>&1
+IF ERRORLEVEL 1 (
+       ECHO FAILED. Run this script with administrator privileges.
+       GOTO ExitBatch
+)
+
 :: Make sure the second path exists. The first path won't be created until the second script is run
 IF NOT EXIST !NEWPATH2! (ECHO Path not found: %NEWPATH2% && GOTO ExitBatch)