Created
January 6, 2023 22:32
-
-
Save InjectedPie/e4de95f11ac8e56d7d02a8d676649397 to your computer and use it in GitHub Desktop.
gets admin and unpacks all pkgs in a folder with the pkg_custom tool from @aldostools https://github.com/aldostools/Resources
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
CLS | |
:init | |
setlocal DisableDelayedExpansion | |
set cmdInvoke=1 | |
set winSysFolder=System32 | |
set "batchPath=%~dpnx0" | |
rem this works also from cmd shell, other than %~0 | |
for %%k in (%0) do set batchName=%%~nk | |
set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs" | |
setlocal EnableDelayedExpansion | |
:checkPrivileges | |
NET FILE 1>NUL 2>NUL | |
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) | |
:getPrivileges | |
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) | |
ECHO. | |
ECHO ************************************** | |
ECHO UAC | |
ECHO ************************************** | |
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%" | |
ECHO args = "ELEV " >> "%vbsGetPrivileges%" | |
ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%" | |
ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%" | |
ECHO Next >> "%vbsGetPrivileges%" | |
if '%cmdInvoke%'=='1' goto InvokeCmd | |
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%" | |
goto ExecElevation | |
:InvokeCmd | |
ECHO args = "/c """ + "!batchPath!" + """ " + args >> "%vbsGetPrivileges%" | |
ECHO UAC.ShellExecute "%SystemRoot%\%winSysFolder%\cmd.exe", args, "", "runas", 1 >> "%vbsGetPrivileges%" | |
:ExecElevation | |
"%SystemRoot%\%winSysFolder%\WScript.exe" "%vbsGetPrivileges%" %* | |
exit /B | |
:gotPrivileges | |
setlocal & cd /d %~dp0 | |
if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1) | |
:::::::::::::::::::::::::::: | |
::START | |
:::::::::::::::::::::::::::: | |
forfiles /s /m *.pkg /c "cmd /c pkg_custom.exe @path" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment