Skip to content

Instantly share code, notes, and snippets.

@realslacker
Last active March 29, 2018 20:26
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 realslacker/722ad2eea135ff571f65f87ba5c37753 to your computer and use it in GitHub Desktop.
Save realslacker/722ad2eea135ff571f65f87ba5c37753 to your computer and use it in GitHub Desktop.
Place in System32 directory to allow you to run WPKG from the command line. Relies on Elevate (see http://code.kliu.org/misc/elevate/) to launch as administrator.
@ECHO OFF
SET ALLARGS=
SET CLOSEMODE=
REM Verify that elevate is installed
IF EXIST C:\Windows\System32\elevate.exe GOTO :SKIPERROR
ECHO This script must be run with Administrator rights!
PAUSE
EXIT 1
:SKIPERROR
REM Check for admin rights
NET SESSION >NUL 2>&1
IF %errorlevel% == 0 GOTO :SKIPELEVATE
elevate.exe /c %~f0 %*
GOTO :EOF
:SKIPELEVATE
REM Set default option to synchronize
IF NOT "%1" == "" GOTO :ARGSLOOP
SET ALLARGS=/synchronize
GOTO :RUNWPKG
:SETNOCLOSE
SET CLOSEMODE=PAUSE
SHIFT
:ARGSLOOP
if "%1" == "" GOTO :RUNWPKG
if "%1" == "/noclose" GOTO :SETNOCLOSE
SET ALLARGS=%ALLARGS% %1
SHIFT
GOTO :ARGSLOOP
:RUNWPKG
cscript.exe %SOFTWARE%\wpkg\wpkg.js %ALLARGS%
%CLOSEMODE%
GOTO :EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment