21 changed files with 1472 additions and 126 deletions
@ -1,85 +0,0 @@
@@ -1,85 +0,0 @@
|
||||
@ECHO OFF |
||||
SET "EXEFOL=D:\WHDownloader\Updates\Office2010-x64" |
||||
SET "MSPFOL=%~dp0\MSPs" |
||||
SET "LANG=en-us" |
||||
SET "PROOFLANG=de-de,fr-fr" |
||||
|
||||
:: credits: hearywarlot |
||||
:: https://forums.mydigitallife.net/threads/64028 |
||||
|
||||
SETLOCAL ENABLEDELAYEDEXPANSION |
||||
|
||||
FSUTIL dirty query "!SYSTEMDRIVE!" >nul 2>&1 |
||||
IF !ERRORLEVEL! neq 0 ( |
||||
( ECHO SET UAC = CreateObject^("Shell.Application"^) |
||||
ECHO UAC.ShellExecute "%~dpf0", ELAV, "", "runas", 1 |
||||
)> "!TEMP!\OEgetPrivileges.vbs" |
||||
"!TEMP!\OEgetPrivileges.vbs" |
||||
DEL "!TEMP!\OEgetPrivileges.vbs" |
||||
EXIT /B |
||||
) |
||||
|
||||
IF not defined EXEFOL ( |
||||
ECHO Please enter the path containing your Office Updates" |
||||
SET /P EXEFOL= |
||||
IF [!EXEFOL!]==[] EXIT /B |
||||
CLS |
||||
) |
||||
IF not defined MSPFOL ( |
||||
ECHO Please enter the path where the MSP will be extracted to" |
||||
SET /P MSPFOL= |
||||
IF [!MSPFOL!]==[] EXIT /B |
||||
CLS |
||||
) |
||||
IF NOT EXIST "!EXEFOL!\" ( |
||||
ECHO Could not find "!EXEFOL!\" |
||||
PAUSE |
||||
EXIT /B |
||||
) |
||||
CD /D "!EXEFOL!" |
||||
IF NOT EXIST "!MSPFOL!" MKDIR "!MSPFOL!" |
||||
For /R %%A in (*.exe) do ( |
||||
PUSHD "%%~dpA" |
||||
ECHO Extracting %%~xnA |
||||
SET "KBFIL=%%~nA" |
||||
for /f "tokens=1 delims=-" %%V in ('dir /b %%~xnA') do set MSPNAM=%%V |
||||
"!KBFIL!.exe" /quiet /EXTRACT:"!KBFIL!" |
||||
IF EXIST "!KBFIL!\" ( |
||||
PUSHD "!KBFIL!" |
||||
FOR /R %%B in (*.msp) do ( |
||||
SETLOCAL |
||||
IF "!LANG!"=="" ( |
||||
SET "TRUE=1" |
||||
) ELSE ( |
||||
SET "RMLNG1=%%~nB" |
||||
CALL SET "RMLNG=%%RMLNG1:-!RMLNG1:*-=!=%%" |
||||
IF "!RMLNG1!"=="!RMLNG!-x-none" ( |
||||
SET "TRUE=1" |
||||
) ELSE ( |
||||
IF "!RMLNG!"=="proof" FOR %%L IN (!PROOFLANG!) DO IF "!RMLNG1!"=="proof-%%L" SET "TRUE=1" |
||||
IF "!RMLNG1!"=="!RMLNG!-!LANG!" ( |
||||
SET "TRUE=1" |
||||
) |
||||
) |
||||
) |
||||
IF "!TRUE!"=="1" ( |
||||
SET "MSPKB1=!KBFIL:*kb=kb!" |
||||
SET "MSPKB2=!MSPKB1:*-=!" |
||||
CALL SET "MSPKB=%%MSPKB1:-!MSPKB2!=%%" |
||||
SET "MSPARC1=!MSPKB2:*-=!" |
||||
SET "MSPARC=!MSPARC1:-glb=!" |
||||
IF "!RMLNG!"=="proof" SET "MSPKB=!MSPKB!-!RMLNG1:proof-=!" |
||||
MOVE /Y "%%~nxB" "!MSPFOL!\z_!MSPNAM!-!MSPKB!-!MSPARC!.msp" >nul |
||||
) |
||||
ENDLOCAL |
||||
) |
||||
POPD |
||||
) |
||||
RD /S /Q "!KBFIL!" |
||||
POPD |
||||
) |
||||
ECHO. |
||||
ECHO Dinner is ready^^! |
||||
|
||||
PAUSE |
||||
EXIT /B |
@ -0,0 +1,240 @@
@@ -0,0 +1,240 @@
|
||||
<!-- : Begin batch script |
||||
@ECHO OFF |
||||
SETLOCAL ENABLEDELAYEDEXPANSION |
||||
mode con cols=180 lines=777 |
||||
|
||||
WHOAMI /Groups | FINDSTR /I /C:"S-1-16-16384" /C:"S-1-16-12288" >NUL || ( |
||||
ECHO(************************************* |
||||
ECHO(Invoking UAC for Privilege Escalation |
||||
ECHO(************************************* |
||||
CSCRIPT //nologo "%~f0?.wsf" //job:ELAV /File:"%~f0" %* |
||||
EXIT /B |
||||
) |
||||
|
||||
|
||||
SET "dirOfEXE=W:\Data\WU\Updates\Office2010-x86" |
||||
SET "dirOfMSP=%~dp0MSPs" |
||||
SET "OldMSPdir=!dirOfMSP!\OLD" |
||||
SET "langOfMSP=en-us" |
||||
SET "ProofLang=es-es,fr-fr" |
||||
|
||||
|
||||
:EvalOpt |
||||
FOR %%A in ( "h|Help" "e|dirOfEXE" "m|dirOfMSP" "o|OldMSPdir" "l|langOfMSP" "p|ProofLang" ) do ( |
||||
FOR /f "delims=| tokens=1-2" %%B in ( "%%~A" ) do ( |
||||
SET "optShort=%%B" |
||||
SET "optLong=%%C" |
||||
SET "TEST=;-!optShort!;--!optLong!;" |
||||
IF not "!TEST:;%~1;=!"=="!TEST!" ( |
||||
IF "!optLong!"=="Help" ( |
||||
ECHO(Recursively extracts MSP files from Office KB packages to a folder with meaningful names |
||||
ECHO( |
||||
ECHO(Options: |
||||
ECHO( -e --dirOfEXE [Folder to execute EXE] |
||||
ECHO( -m --dirOfMSP [Folder to extract MSP] |
||||
ECHO( -o --OldMSPdir [Folder to move old MSP versions] |
||||
ECHO( -l --langOfMSP [KB Language] |
||||
ECHO( -p --ProofLang [Proof Language's] |
||||
ECHO( -h --Help ^(Will display help text^) |
||||
ECHO( |
||||
ECHO(Example: |
||||
ECHO( "file.cmd" -e "D:\WHDownloader\Updates\Office2010-x64" --dirOfMSP "E:\MSPs" -o "E:\oldMSPs" --langOfMSP "en-us" -p "fr-fr,es-es" |
||||
ECHO( |
||||
ECHO(Proofing package has additional companion languages. |
||||
ECHO(To find out which you need, check out the link below which fit with your office version. |
||||
ECHO( Office 2010: "technet.microsoft.com/en-us/library/ee942198(v=office.14).aspx" |
||||
ECHO( Office 2013/365 ProPlus: "technet.microsoft.com/en-us/library/ee942198(v=office.15).aspx" |
||||
ECHO( Office 2016: Not needed, all packages are language neutral or automatically chosen. |
||||
PAUSE |
||||
EXIT /B |
||||
) else ( |
||||
SET "!optLong!=%~2" |
||||
SHIFT /1 |
||||
) |
||||
GOTO :breakEvalOpt |
||||
) |
||||
) |
||||
) |
||||
:breakEvalOpt |
||||
IF not "%~1"=="" ( |
||||
SHIFT /1 |
||||
GOTO :EvalOpt |
||||
) |
||||
FOR %%A in ( "dirOfEXE" "dirOfMSP" "OldMSPdir" ) do ( |
||||
SET "optVital=%%~A" |
||||
IF not defined !optVital! ( |
||||
ECHO(Please enter data for '!optVital!' of your Office Updates" |
||||
SET /p "!optVital!=!optVital!:" |
||||
ECHO( |
||||
) |
||||
If "!%%~A!"=="" ( |
||||
ECHO(Error: Can't continue because of empty var: '!optVital!'^^! |
||||
PAUSE |
||||
EXIT /b |
||||
) |
||||
) |
||||
) |
||||
|
||||
|
||||
DIR /a-d /s "!dirOfEXE!\*-*-*-x*-*.exe" >NUL 2>&1 || SET "ERREXE=1" |
||||
DIR /a-d /s "!dirOfEXE!\*-*-*-x*-*.cab" >NUL 2>&1 || SET "ERRCAB=1" |
||||
IF defined ERREXE IF defined ERRCAB ( |
||||
ECHO(ERROR: Folder or valid named Office update files could not be found at "!dirOfEXE!\"^^! |
||||
GOTO :EndOfFile |
||||
) |
||||
CD /d "!dirOfEXE!\" |
||||
IF not exist "!dirOfMSP!\" ( MKDIR "!dirOfMSP!" ) |
||||
FOR /r %%A in ("*-*-*-x*-*.exe") do ( |
||||
PUSHD "%%~dpA" |
||||
SET "fileOfEXE=%%~nA" |
||||
ECHO(Extracting "!fileOfEXE!.exe" |
||||
"!fileOfEXE!.exe" /quiet /extract:"!dirOfMSP!\!fileOfEXE!" |
||||
IF not exist "!dirOfMSP!\!fileOfEXE!\" ( |
||||
SET "ercFailEXE=!ERRORLEVEL!" |
||||
SET /a "cntFailEXE+=1" |
||||
SET "excFailEXE!cntFailEXE!=%%~fA" |
||||
SET "ercFailEXE!cntFailEXE!=!ercFailEXE!" |
||||
ECHO(ERROR: No folder was made after executing "!fileOfEXE!.exe"^^! |
||||
) else ( |
||||
CALL :doMSP |
||||
) |
||||
POPD |
||||
ECHO( |
||||
ECHO( |
||||
) |
||||
FOR /r %%A in ("*-*-*-x*-*.cab") do ( |
||||
PUSHD "%%~dpA" |
||||
SET "fileOfEXE=%%~nA" |
||||
ECHO(Extracting "!fileOfEXE!.cab" |
||||
mkdir "!dirOfMSP!\!fileOfEXE!" 2>NUL |
||||
expand.exe -r -f:*.msp "!fileOfEXE!.cab" "!dirOfMSP!\!fileOfEXE!" >NUL |
||||
IF not exist "!dirOfMSP!\!fileOfEXE!\*.msp" ( |
||||
SET "ercFailEXE=!ERRORLEVEL!" |
||||
SET /a "cntFailEXE+=1" |
||||
SET "excFailEXE!cntFailEXE!=%%~fA" |
||||
SET "ercFailEXE!cntFailEXE!=!ercFailEXE!" |
||||
ECHO(ERROR: No folder was made after extracting "!fileOfEXE!.cab"^^! |
||||
) else ( |
||||
CALL :doMSP |
||||
) |
||||
POPD |
||||
ECHO( |
||||
ECHO( |
||||
) |
||||
ECHO( |
||||
IF defined ercFailEXE ( |
||||
ECHO(A number of !cntFailEXE! executables have failed to extract folders. |
||||
ECHO(The following have failed: |
||||
FOR /L %%A in (1,1,!cntFailEXE!) Do ( |
||||
ECHO( |
||||
ECHO(File: "!excFailEXE%%A!" |
||||
ECHO(Errorcode: "!ercFailEXE%%A!" |
||||
) |
||||
) else ( |
||||
ECHO(Dinner is ready^^! |
||||
) |
||||
|
||||
:EndOfFile |
||||
ECHO( |
||||
ECHO( |
||||
ECHO(Written and maintained by Hearlywarlot |
||||
ECHO(For updates on the script or other nice things visit our awesome Forum at: |
||||
ECHO(forums.mydigitallife.net/threads/64028/ |
||||
ECHO( |
||||
|
||||
DEL /F /Q "!TEMP!\opatchinstall*.log" >NUL 2>&1 |
||||
ENDLOCAL |
||||
PAUSE |
||||
EXIT /b |
||||
|
||||
:doMSP |
||||
PUSHD "!dirOfMSP!\!fileOfEXE!\" |
||||
ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
||||
FOR /r %%B in ("*.msp") do ( |
||||
SET "fileOfMSP=%%~nB" |
||||
FOR /f "delims=-" %%C in ( "!fileOfMSP!" ) do ( |
||||
SET "nameOfMSP=%%C" |
||||
SET "TRUE=" |
||||
IF "!langOfMSP!"=="" ( |
||||
SET "TRUE=1" |
||||
) else ( |
||||
IF /I "!fileOfMSP!"=="!nameOfMSP!-x-none" ( |
||||
SET "TRUE=1" |
||||
) ELSE IF /I "!fileOfMSP!"=="!nameOfMSP!" ( |
||||
SET "TRUE=1" |
||||
) ELSE ( |
||||
IF "!ProofLang!"=="" ( |
||||
IF /I "!nameOfMSP!"=="proof" ( SET "TRUE=1" ) |
||||
) |
||||
IF not "!ProofLang!"=="" FOR %%D in ( !ProofLang! ) do ( |
||||
IF /I "!fileOfMSP!"=="proof-%%D" ( SET "TRUE=1" ) |
||||
) |
||||
IF not "!langOfMSP!"=="" FOR %%D in ( !langOfMSP! ) do ( |
||||
IF /I "!fileOfMSP!"=="!nameOfMSP!-%%D" ( SET "TRUE=1" ) |
||||
) |
||||
) |
||||
) |
||||
IF defined TRUE ( |
||||
FOR /f "tokens=1-2,4 delims=-" %%D in ( "!fileOfEXE!" ) do ( |
||||
SET "nameOfEXE=%%D" |
||||
SET "kbOfEXE=%%E" |
||||
SET "archOfEXE=%%F" |
||||
) |
||||
SET "_I=Y" |
||||
ECHO !fileOfMSP! | FINDSTR /I /V "x-none" | FINDSTR /I /R ".*-.*-.*" >NUL && ( |
||||
SET "_I=Z" |
||||
) |
||||
SET "NewMSPpath=!_I!_!nameOfEXE!_!kbOfEXE!_!archOfEXE!_!fileOfMSP!.msp" |
||||
ECHO(Moving "!fileOfMSP!.msp" to "!NewMSPpath!" |
||||
IF not exist "!dirOfMSP!\!NewMSPpath!" ( |
||||
MOVE "!fileOfMSP!.msp" "!dirOfMSP!\!NewMSPpath!" >NUL |
||||
) else ( |
||||
ECHO( ^<= File already exists, skipping =^> |
||||
) |
||||
) |
||||
) |
||||
) |
||||
IF defined NewMSPpath ( |
||||
FOR /F "tokens=1-5 delims=_" %%D in ('DIR /B /A:-D "!dirOfMSP!\!_I!_!nameOfEXE!_kb*_!archOfEXE!_*.msp"') do ( |
||||
IF /I not "%%F" == "!kbOfEXE!" IF /I "%%H" == "!fileOfMSP!.msp" ( |
||||
IF not exist "!OldMSPdir!\" ( MKDIR "!OldMSPdir!" ) |
||||
SET "OldMSPfile=%%D_%%E_%%F_%%G_%%H" |
||||
ECHO( ^<= Moving older version " !OldMSPfile!" =^> |
||||
MOVE "!dirOfMSP!\!OldMSPfile!" "!OldMSPdir!\" >NUL |
||||
) |
||||
) |
||||
Set "NewMSPpath=" |
||||
) else ( |
||||
ECHO( ^<= Oh my, It appears none of the MSP files were applicable to your given languages =^> |
||||
) |
||||
ECHO(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
||||
POPD |
||||
rem. ECHO(Removing folder "!dirOfMSP!\!fileOfEXE!\" |
||||
RD /s /q "!dirOfMSP!\!fileOfEXE!\" |
||||
EXIT /b |
||||
|
||||
----- Begin wsf script ---> |
||||
<package> |
||||
<job id="ELAV"> |
||||
<script language="VBScript"> |
||||
Set strArg=WScript.Arguments.Named |
||||
|
||||
If Not strArg.Exists("File") Then |
||||
Wscript.Echo "Switch /File:<File> is missing." |
||||
WScript.Quit 1 |
||||
End If |
||||
|
||||
Set strRdlproc = CreateObject("WScript.Shell").Exec("rundll32 kernel32,Sleep") |
||||
With GetObject("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" & strRdlproc.ProcessId & "'") |
||||
With GetObject("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" & .ParentProcessId & "'") |
||||
If InStr (.CommandLine, WScript.ScriptName) <> 0 Then |
||||
strLine = Mid(.CommandLine, InStr(.CommandLine , "/File:") + Len(strArg("File")) + 8) |
||||
End If |
||||
End With |
||||
.Terminate |
||||
End With |
||||
|
||||
CreateObject("Shell.Application").ShellExecute "cmd", "/c " & chr(34) & chr(34) & strArg("File") & chr(34) & " " & strLine & chr(34), "", "runas", 1 |
||||
</script> |
||||
</job> |
||||
</package> |
@ -0,0 +1,313 @@
@@ -0,0 +1,313 @@
|
||||
@setlocal DisableDelayedExpansion |
||||
@set uivr=v0.3 |
||||
@echo off |
||||
:: Change to 0 to skip adding SSU to the msu file |
||||
set IncludeSSU=1 |
||||
|
||||
set _Debug=0 |
||||
|
||||
set "_cmdf=%~f0" |
||||
if exist "%SystemRoot%\Sysnative\cmd.exe" ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
set _dpx=0 |
||||
set _exd=0 |
||||
set fail=0 |
||||
set DD64create=0 |
||||
set DD86create=0 |
||||
set "sdl=dpx.dll ReserveManager.dll TurboStack.dll UpdateAgent.dll UpdateCompression.dll wcp.dll" |
||||
set "onf=onepackage.AggregatedMetadata.cab" |
||||
set "_Null=1>nul 2>nul" |
||||
set "_err===== ERROR ====" |
||||
set "_ntc===== NOTICE ====" |
||||
set "_repo=" |
||||
set "_args=" |
||||
set "_args=%~1" |
||||
if not defined _args goto :NoProgArgs |
||||
if "%~1"=="" set "_args="&goto :NoProgArgs |
||||
|
||||
:NoProgArgs |
||||
set "SysPath=%SystemRoot%\System32" |
||||
set "Path=%SystemRoot%\System32;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0\" |
||||
if exist "%SystemRoot%\Sysnative\reg.exe" ( |
||||
set "SysPath=%SystemRoot%\Sysnative" |
||||
set "Path=%SystemRoot%\Sysnative;%SystemRoot%\Sysnative\Wbem;%SystemRoot%\Sysnative\WindowsPowerShell\v1.0\;%Path%" |
||||
) |
||||
set "xOS=amd64" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="arm64" set "xOS=arm64" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" set "xOS=x86" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="amd64" set "xOS=amd64" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="arm64" set "xOS=arm64" |
||||
set "_log=%~dpn0" |
||||
set "_work=%~dp0" |
||||
set "_work=%_work:~0,-1%" |
||||
set _drv=%~d0 |
||||
for /f "skip=2 tokens=2*" %%a in ('reg.exe query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do call set "_dsk=%%b" |
||||
if exist "%PUBLIC%\Desktop\desktop.ini" set "_dsk=%PUBLIC%\Desktop" |
||||
setlocal EnableDelayedExpansion |
||||
|
||||
if defined _args goto :chkarg |
||||
if exist "!_work!\*.AggregatedMetadata*.cab" if exist "!_work!\Windows1*-KB*.cab" if exist "!_work!\Windows1*-KB*.psf" ( |
||||
if exist "!_work!\*DesktopDeployment*.cab" set "_repo=!_work!" |
||||
if exist "!_work!\SSU-*-*.cab" set "_repo=!_work!" |
||||
) |
||||
:chkarg |
||||
if not defined _args goto :continue |
||||
if exist "!_args!\*.AggregatedMetadata*.cab" if exist "!_args!\Windows1*-KB*.cab" if exist "!_args!\Windows1*-KB*.psf" ( |
||||
if exist "!_args!\*DesktopDeployment*.cab" set "_repo=!_args!" |
||||
if exist "!_args!\SSU-*-*.cab" set "_repo=!_args!" |
||||
) |
||||
|
||||
:continue |
||||
if %_Debug% equ 0 ( |
||||
set "_Nul1=1>nul" |
||||
set "_Nul2=2>nul" |
||||
set "_Nul6=2^>nul" |
||||
set "_Nul3=1>nul 2>nul" |
||||
set "_Pause=pause >nul" |
||||
set "_Exit=echo Press any key to exit." |
||||
set "_Supp=" |
||||
goto :Begin |
||||
) |
||||
set "_Nul1=" |
||||
set "_Nul2=" |
||||
set "_Nul6=" |
||||
set "_Nul3=" |
||||
set "_Pause=rem." |
||||
set "_Exit=rem." |
||||
set "_Supp=1>nul" |
||||
copy /y nul "!_work!\#.rw" %_Null% && (if exist "!_work!\#.rw" del /f /q "!_work!\#.rw") || (set "_log=!_dsk!\%~n0") |
||||
echo. |
||||
echo Running in Debug Mode... |
||||
echo The window will be closed when finished |
||||
@echo on |
||||
@prompt $G |
||||
@call :Begin >"!_log!_tmp.log" 2>&1 &cmd /u /c type "!_log!_tmp.log">"!_log!_Debug.log"&del "!_log!_tmp.log" |
||||
@color 07 |
||||
@title %ComSpec% |
||||
@exit /b |
||||
|
||||
:Begin |
||||
title PSFXv2 MSU Maker %uivr% |
||||
if %_Debug% equ 0 if not defined _args @cls |
||||
if not defined _repo goto :N_PT |
||||
pushd "!_repo!" |
||||
for /f "delims=" %%# in ('dir /b /a:-d "*.AggregatedMetadata*.cab"') do set "metaf=%%#" |
||||
if /i "%metaf%"=="%onf%" ( |
||||
ren "%metaf%" "org_%metaf%" |
||||
set "metaf=org_%metaf%" |
||||
) |
||||
expand.exe -f:LCUCompDB*.xml.cab "%metaf%" . %_Null% |
||||
if not exist "LCUCompDB*.xml.cab" goto :E_DB |
||||
for /f %%# in ('dir /b /a:-d "LCUCompDB*.xml.cab"') do set "dblcu=%%#" |
||||
for /f "tokens=2 delims=_." %%# in ('echo %dblcu%') do set "kbn=%%#" |
||||
if not exist "Windows1*%kbn%*.cab" set xtn=cab&goto :E_KB |
||||
if not exist "Windows1*%kbn%*.psf" set xtn=psf&goto :E_KB |
||||
for /f "tokens=3 delims=-_" %%# in ('dir /b /a:-d "Windows1*%kbn%*.cab"') do set "bit=%%~n#" |
||||
if exist "Windows1*%kbn%*%bit%*.msu" goto :N_MS |
||||
for /f "delims=" %%# in ('dir /b /a:-d "Windows1*%kbn%*%bit%*.cab"') do set "_sCAB=%%#" |
||||
for /f "delims=" %%# in ('dir /b /a:-d "Windows1*%kbn%*%bit%*.psf"') do set "_sPSF=%%#" |
||||
set "kbf=Windows10.0-%kbn%-%bit%" |
||||
if /i "%_sCAB:~0,10%"=="Windows11." set "kbf=Windows11.0-%kbn%-%bit%" |
||||
if exist "SSU-*%bit%*.cab" ( |
||||
for /f "tokens=2 delims=-" %%# in ('dir /b /a:-d "SSU-*%bit%*.cab"') do set "suf=SSU-%%#-%bit%.cab" |
||||
for /f "delims=" %%# in ('dir /b /a:-d "SSU-*%bit%*.cab"') do set "_sSSU=%%#" |
||||
expand.exe -f:SSUCompDB*.xml.cab "%metaf%" . %_Null% |
||||
if exist "SSU*-express.xml.cab" del /f /q "SSU*-express.xml.cab" |
||||
if not exist "SSUCompDB*.xml.cab" set IncludeSSU=0 |
||||
) else ( |
||||
set IncludeSSU=0 |
||||
) |
||||
if %IncludeSSU% equ 1 for /f %%# in ('dir /b /a:-d "SSUCompDB*.xml.cab"') do set "dbssu=%%#" |
||||
set "_sDDD=DesktopDeployment_x86.cab" |
||||
if exist "*DesktopDeployment*.cab" ( |
||||
for /f "delims=" %%# in ('dir /b /a:-d "*DesktopDeployment*.cab" ^|find /i /v "%_sDDD%"') do set "_sDDC=%%#" |
||||
) |
||||
if exist "%SysPath%\ucrtbase.dll" call :dodpx |
||||
if not defined _sDDC ( |
||||
call set "_sDDC=DesktopDeployment.cab" |
||||
call :DDCAB |
||||
) |
||||
if %fail% equ 1 goto :TheEnd |
||||
if defined suf if /i not %bit%==x86 if not exist "%_sDDD%" call :DDC86 |
||||
call :DDF %onf% |
||||
(echo "%dblcu%" |
||||
if %IncludeSSU% equ 1 echo "%dbssu%" |
||||
)>>zzz.ddf |
||||
%_Null% makecab.exe /F zzz.ddf /D Compress=ON /D CompressionType=MSZIP |
||||
call :DDF %kbf%.msu |
||||
(echo "%_sDDC%" "DesktopDeployment.cab" |
||||
if exist "%_sDDD%" echo "%_sDDD%" "DesktopDeployment_x86.cab" |
||||
echo "%onf%" |
||||
if %IncludeSSU% equ 1 echo "%_sSSU%" "%suf%" |
||||
echo "%_sCAB%" "%kbf%.cab" |
||||
echo "%_sPSF%" "%kbf%.psf" |
||||
)>>zzz.ddf |
||||
%_Null% makecab.exe /F zzz.ddf /D Compress=OFF |
||||
echo. |
||||
echo Finished |
||||
echo. |
||||
goto :TheEnd |
||||
|
||||
:DDCAB |
||||
echo. |
||||
echo Extracting: %_sSSU% |
||||
if exist "_tmpSSU\" rmdir /s /q "_tmpSSU\" %_Nul3% |
||||
mkdir "_tmpSSU\000" |
||||
expand.exe -f:* %_sSSU% _tmpSSU %_Null% || ( |
||||
rmdir /s /q "_tmpSSU\" %_Nul3% |
||||
echo failed. |
||||
echo. |
||||
echo Provide ready DesktopDeployment.cab and try again |
||||
echo. |
||||
set fail=1 |
||||
goto :eof |
||||
) |
||||
set xbt=%bit% |
||||
if /i %bit%==x64 set xbt=amd64 |
||||
for /f %%# in ('dir /b /ad "_tmpSSU\%xbt%_microsoft-windows-servicingstack_*"') do set "src=%%#" |
||||
for %%# in (%sdl%) do if exist "_tmpSSU\%src%\%%#" (move /y "_tmpSSU\%src%\%%#" "_tmpSSU\000\%%#" %_Nul1%) |
||||
set DD64create=1 |
||||
call :DDF %_sDDC% |
||||
call :ADD _tmpSSU\000 |
||||
%_Null% makecab.exe /F zzz.ddf /D Compress=ON /D CompressionType=MSZIP |
||||
mkdir "_tmpSSU\111" |
||||
if /i not %bit%==x86 if not exist "DesktopDeployment_x86.cab" goto :DDCdu |
||||
rmdir /s /q "_tmpSSU\" %_Nul3% |
||||
exit /b |
||||
|
||||
:DDC86 |
||||
echo. |
||||
echo Extracting: %_sSSU% |
||||
if exist "_tmpSSU\" rmdir /s /q "_tmpSSU\" %_Nul3% |
||||
mkdir "_tmpSSU\111" |
||||
expand.exe -f:* %_sSSU% _tmpSSU %_Null% || ( |
||||
rmdir /s /q "_tmpSSU\" %_Nul3% |
||||
echo failed. |
||||
echo. |
||||
echo Skipping DesktopDeployment_x86.cab |
||||
echo see ReadMe.txt for more details |
||||
goto :eof |
||||
) |
||||
:DDCdu |
||||
for /f %%# in ('dir /b /ad "_tmpSSU\x86_microsoft-windows-servicingstack_*"') do set "src=%%#" |
||||
for %%# in (%sdl%) do if exist "_tmpSSU\%src%\%%#" (move /y "_tmpSSU\%src%\%%#" "_tmpSSU\111\%%#" %_Nul1%) |
||||
set DD86create=1 |
||||
call :DDF %_sDDD% |
||||
call :ADD _tmpSSU\111 |
||||
%_Null% makecab.exe /F zzz.ddf /D Compress=ON /D CompressionType=MSZIP |
||||
rmdir /s /q "_tmpSSU\" %_Nul3% |
||||
exit /b |
||||
|
||||
:DDF |
||||
echo. |
||||
echo Creating: %1 |
||||
(echo .Set DiskDirectoryTemplate="." |
||||
echo .Set CabinetNameTemplate="%1" |
||||
echo .Set MaxCabinetSize=0 |
||||
echo .Set MaxDiskSize=0 |
||||
echo .Set FolderSizeThreshold=0 |
||||
echo .Set RptFileName=nul |
||||
echo .Set InfFileName=nul |
||||
echo .Set Cabinet=ON |
||||
)>zzz.ddf |
||||
exit /b |
||||
|
||||
:ADD |
||||
(echo .Set SourceDir="%1" |
||||
echo "dpx.dll" |
||||
echo "ReserveManager.dll" |
||||
echo "TurboStack.dll" |
||||
echo "UpdateAgent.dll" |
||||
echo "wcp.dll" |
||||
if exist "%1\UpdateCompression.dll" echo "UpdateCompression.dll" |
||||
)>>zzz.ddf |
||||
exit /b |
||||
|
||||
:dodpx |
||||
set _nat=0 |
||||
set _wow=0 |
||||
if /i %bit%==%xOS% set _nat=1 |
||||
if /i %bit%==x64 if /i %xOS%==amd64 set _nat=1 |
||||
if %_nat% equ 0 set _wow=1 |
||||
|
||||
if exist "!_repo!\dpx.dll" if not exist "!_repo!\expand.exe" ( |
||||
if %_wow% equ 1 copy /y %SystemRoot%\SysWOW64\expand.exe "!_repo!\" %_Nul3% |
||||
if %_nat% equ 1 copy /y %SysPath%\expand.exe "!_repo!\" %_Nul3% |
||||
set _exd=1 |
||||
exit /b |
||||
) |
||||
if %_wow% equ 1 if exist "%_sDDD%" ( |
||||
expand.exe -f:dpx.dll "%_sDDD%" "!_repo!" %_Nul3% |
||||
if exist "!_repo!\dpx.dll" ( |
||||
copy /y %SystemRoot%\SysWOW64\expand.exe "!_repo!\" %_Nul3% |
||||
set _dpx=1 |
||||
exit /b |
||||
) |
||||
) |
||||
if %_nat% equ 1 if defined _sDDC ( |
||||
expand.exe -f:dpx.dll "%_sDDC%" "!_repo!" %_Nul3% |
||||
if exist "!_repo!\dpx.dll" ( |
||||
copy /y %SysPath%\expand.exe "!_repo!\" %_Nul3% |
||||
set _dpx=1 |
||||
exit /b |
||||
) |
||||
) |
||||
exit /b |
||||
|
||||
:E_KB |
||||
echo. |
||||
echo %_err% |
||||
echo. |
||||
echo LCU %kbn% %xtn% file is missing |
||||
echo. |
||||
goto :TheEnd |
||||
|
||||
:E_DB |
||||
echo. |
||||
echo %_err% |
||||
echo. |
||||
echo LCUCompDB file is missing from AggregatedMetadata |
||||
echo. |
||||
goto :TheEnd |
||||
|
||||
:N_MS |
||||
echo. |
||||
echo %_ntc% |
||||
echo. |
||||
echo LCU %kbn% msu file already exist |
||||
echo. |
||||
goto :TheEnd |
||||
|
||||
:N_PT |
||||
echo. |
||||
echo %_ntc% |
||||
echo. |
||||
echo Could not find all required update files |
||||
echo. |
||||
goto :TheEnd |
||||
|
||||
:TheEnd |
||||
if exist "zzz.ddf" del /f /q "zzz.ddf" |
||||
if exist "LCUCompDB*.xml.cab" del /f /q "LCUCompDB*.xml.cab" |
||||
if exist "SSUCompDB*.xml.cab" del /f /q "SSUCompDB*.xml.cab" |
||||
if exist "%onf%" del /f /q "%onf%" |
||||
if %DD86create% equ 1 if exist "DesktopDeployment_x86.cab" del /f /q "DesktopDeployment_x86.cab" |
||||
if %DD64create% equ 1 if exist "DesktopDeployment.cab" del /f /q "DesktopDeployment.cab" |
||||
if %_exd% equ 1 ( |
||||
if exist "expand.exe" del /f /q "expand.exe" %_Nul3% |
||||
) |
||||
if %_dpx% equ 1 ( |
||||
if exist "dpx.dll" del /f /q "dpx.dll" %_Nul3% |
||||
if exist "expand.exe" del /f /q "expand.exe" %_Nul3% |
||||
) |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
# PSFX MSU Maker |
||||
|
||||
## Info |
||||
|
||||
- Automated command script to create Windows 11 LCU MSU file out of the UUP update files |
||||
|
||||
## Requirements |
||||
|
||||
- Mandatory : LCU cab and psf files |
||||
- Mandatory : AggregatedMetadata cab file |
||||
- Mandatory : DesktopDeployment cab file or SSU cab file |
||||
- Recommended: DesktopDeployment cab file and SSU cab file |
||||
- Optional : DesktopDeployment_x86.cab file |
||||
|
||||
example: |
||||
``` |
||||
886fa207-124a-4633-9f08-438f1c614f28.AggregatedMetadata.cab |
||||
DesktopDeployment.cab |
||||
SSU-22000.345-x64.cab |
||||
Windows10.0-KB5007262-x64.cab |
||||
Windows10.0-KB5007262-x64.psf |
||||
``` |
||||
|
||||
## Usage |
||||
|
||||
- Make sure the downloaded files are not read-only or blocked |
||||
|
||||
- Extract this package zip file to a folder with a simple path |
||||
|
||||
- Copy or move the needed files next to the script, then run PSFX2MSU.cmd |
||||
|
||||
- Alternatively from command prompt, run the script and provide path to the folder containing the files |
||||
|
||||
example: |
||||
`PSFX2MSU.cmd E:\Downloads\uup-converter\UUPs` |
||||
|
||||
- The result msu file will be located in the same source folder (current or provided) |
||||
|
||||
example: |
||||
`Windows10.0-KB5007262-x64.msu` |
||||
|
||||
## Remarks |
||||
|
||||
- To install the created msu on live OS, you **must use** command line tool **DISM.exe** |
||||
you cannot install it normally by launching the msu itself directly |
||||
|
||||
example: |
||||
`DISM /Online /Add-Package=E:\Downloads\uup-converter\UUPs\Windows10.0-KB5007262-x64.msu` |
||||
|
||||
- The script do not require administrator privileges |
||||
however, if you get Access Denied errors, run it as administrator |
||||
|
||||
- DesktopDeployment.cab and DesktopDeployment_x86.cab will be constructed, if not provided |
||||
|
||||
- If DesktopDeployment_x86.cab is not provided or creation failed, the result msu can be used as follows: |
||||
|
||||
x64 msu: installed on live OS only, or require x64 Host OS to add msu for x64 image |
||||
|
||||
arm64 msu: installed on live OS only, or require arm64 Host OS to add msu for arm64 image |
||||
|
||||
- The script can create MSU only for one LCU at a time (based on AggregatedMetadata.cab) |
||||
|
||||
- Advanced: edit the script to change the manual option `IncludeSSU` or enable debug mode `_Debug` |
||||
|
||||
## Background |
||||
|
||||
- Windows 11 Latest Cumulative Update (LCU) is available only as a PSFX v2 format |
||||
|
||||
It consist of a cab file that contain the update packages and components manifests, |
||||
and a psf file that contain forward-only differentials payload files, which require WinSxS source files |
||||
|
||||
- The corresponding msu update file also introduce a new combined UUP format |
||||
|
||||
https://techcommunity.microsoft.com/t5/windows-it-pro-blog/windows-11-cumulative-update-improvements-an-overview/ba-p/2842961 |
||||
|
||||
- Installing this MSU with DISM.exe tool can be accomplished in two ways: |
||||
|
||||
Old: |
||||
extract the cab/psf files and use PSFExtractor to generate the payload files |
||||
the installed update will be missing the reverse differentials |
||||
|
||||
New: |
||||
add the msu file directly, even on current running live OS |
||||
the installation process will generate the reverse differentials |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
# PSFX Repack |
||||
|
||||
## Info |
||||
|
||||
- Some Windows 11/10 updates are available as a PSFX format |
||||
|
||||
It consist of cab file that contain the update manifests, and psf file that contain the raw payload files |
||||
|
||||
- There are two types of this format: |
||||
|
||||
PSFX v2: delta update files which require WinSxS source files |
||||
|
||||
Baseless PSFX: complete update files which have no dependencies |
||||
|
||||
- To use those files with DISM `/Add-Package` command, it is required to extract (generate) the actual payload files first |
||||
|
||||
Afterward, you can use the extracted folder path with DISM, or compress the folder into a full cab file or esd file |
||||
|
||||
- The provided scripts automate the process and repackage the psf/cab files into full file |
||||
|
||||
## Usage |
||||
|
||||
- Extract this package zip file to a folder with a simple path |
||||
|
||||
- Copy or move the psf/cab files next to the script, then run one of the scripts: |
||||
|
||||
**psfx2cab_CLI.cmd** |
||||
use cabarc.exe to create the full cab file / no progress info shown |
||||
|
||||
**psfx2cab_GUI.cmd** |
||||
use DXTool.exe to create the full cab file / show GUI progress info |
||||
|
||||
**psfx2esd_CLI.cmd** |
||||
use imagex.exe to create the full esd file / show percentage progress info |
||||
|
||||
- Or from command prompt, run the desired script and provide path to the folder containing psf/cab files |
||||
|
||||
example: |
||||
`psfx2cab_CLI.cmd E:\Downloads\uup-converter\UUPs` |
||||
|
||||
- The result file will be located in the same folder (current or provided) |
||||
and it will have the same name of the original cab file, appended with -full_psfx |
||||
|
||||
example: |
||||
`windows10.0-kb5004564-arm64-full_psfx.cab` |
||||
|
||||
## Remarks |
||||
|
||||
- The script do not require administrator privileges |
||||
however, if you get Access Denied errors, run it as administrator |
||||
|
||||
- CAB file has limitation by design: 2 GB size - 65535 included files/directories |
||||
|
||||
if you are repacking big baseless update, it's recomended to create esd file instead |
||||
|
||||
- **psfx2esd_CLI.cmd** is set to create the full esd file with max-compression ratio |
||||
|
||||
if you want to create the file with solid high-compression ratio (require high amount of CPU/RAM), |
||||
edit the script and uncomment this line: |
||||
`set compress=LZMS` |
||||
|
||||
## Credits |
||||
|
||||
- [PSFExtractor / th1r5bvn23](https://github.com/Secant1006/PSFExtractor) |
||||
- [OnePiece / DXTool](https://ryanvm.net/forum/viewtopic.php?f=7&t=9945) |
||||
- [Melinda Bellemore / SxSExpand](https://forums.mydigitallife.net/members/superbubble.250156/) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<configuration> |
||||
<startup> |
||||
<supportedRuntime version="v4.0"/> |
||||
<supportedRuntime version="v2.0.50727"/> |
||||
</startup> |
||||
</configuration> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,241 @@
@@ -0,0 +1,241 @@
|
||||
@setlocal DisableDelayedExpansion |
||||
@set uivr=v0.6 |
||||
@echo off |
||||
set _Debug=0 |
||||
|
||||
set "_cmdf=%~f0" |
||||
if exist "%SystemRoot%\Sysnative\cmd.exe" ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
set "_Null=1>nul 2>nul" |
||||
set "_err===== ERROR ====" |
||||
set _pcab= |
||||
set "_args=" |
||||
set "_args=%~1" |
||||
if not defined _args goto :NoProgArgs |
||||
if "%~1"=="" set "_args="&goto :NoProgArgs |
||||
|
||||
:NoProgArgs |
||||
set "SysPath=%SystemRoot%\System32" |
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (set "SysPath=%SystemRoot%\Sysnative") |
||||
set "Path=%SysPath%;%SystemRoot%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\" |
||||
set "xBT=x64" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="arm64" set "xBT=x86" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" set "xBT=x86" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="amd64" set "xBT=x64" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="arm64" set "xBT=x86" |
||||
for /f "tokens=6 delims=[]. " %%# in ('ver') do set winbuild=%%# |
||||
set _pwsh=1 |
||||
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _pwsh=0 |
||||
if %winbuild% geq 22483 if %_pwsh% EQU 0 goto :E_PS |
||||
set "_log=%~dpn0" |
||||
set "_work=%~dp0" |
||||
set "_work=%_work:~0,-1%" |
||||
set _drv=%~d0 |
||||
for /f "skip=2 tokens=2*" %%a in ('reg.exe query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do call set "_dsk=%%b" |
||||
if exist "%PUBLIC%\Desktop\desktop.ini" set "_dsk=%PUBLIC%\Desktop" |
||||
set psfnet=0 |
||||
if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" set psfnet=1 |
||||
if exist "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\ngen.exe" set psfnet=1 |
||||
for %%# in (E F G H I J K L M N O P Q R S T U V W X Y Z) do ( |
||||
set "_adr%%#=%%#" |
||||
) |
||||
if %winbuild% lss 22483 for /f "tokens=2 delims==:" %%# in ('"wmic path Win32_Volume where (DriveLetter is not NULL) get DriveLetter /value" ^| findstr ^=') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
if %winbuild% lss 22483 for /f "tokens=2 delims==:" %%# in ('"wmic path Win32_LogicalDisk where (DeviceID is not NULL) get DeviceID /value" ^| findstr ^=') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
if %winbuild% geq 22483 for /f "tokens=1 delims=:" %%# in ('powershell -nop -c "(([WMISEARCHER]'Select * from Win32_Volume where DriveLetter is not NULL').Get()).DriveLetter; (([WMISEARCHER]'Select * from Win32_LogicalDisk where DeviceID is not NULL').Get()).DeviceID"') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
for %%# in (E F G H I J K L M N O P Q R S T U V W X Y Z) do ( |
||||
if not defined _sdr (if defined _adr%%# set "_sdr=%%#:") |
||||
) |
||||
setlocal EnableDelayedExpansion |
||||
if exist "!_work!\*.cab" if exist "!_work!\*.psf" set "_pcab=!_work!" |
||||
if defined _args if exist "!_args!\*.cab" if exist "!_args!\*.psf" set "_pcab=%~1" |
||||
|
||||
if %_Debug% equ 0 ( |
||||
set "_Nul1=1>nul" |
||||
set "_Nul2=2>nul" |
||||
set "_Nul6=2^>nul" |
||||
set "_Nul3=1>nul 2>nul" |
||||
set "_Pause=pause >nul" |
||||
set "_Contn=echo Press any key to continue..." |
||||
set "_Exit=echo Press any key to exit." |
||||
set "_Supp=" |
||||
goto :Begin |
||||
) |
||||
set "_Nul1=" |
||||
set "_Nul2=" |
||||
set "_Nul6=" |
||||
set "_Nul3=" |
||||
set "_Pause=rem." |
||||
set "_Contn=rem." |
||||
set "_Exit=rem." |
||||
set "_Supp=1>nul" |
||||
copy /y nul "!_work!\#.rw" %_Null% && (if exist "!_work!\#.rw" del /f /q "!_work!\#.rw") || (set "_log=!_dsk!\%~n0") |
||||
echo. |
||||
echo Running in Debug Mode... |
||||
echo The window will be closed when finished |
||||
@echo on |
||||
@prompt $G |
||||
@call :Begin >"!_log!_tmp.log" 2>&1 &cmd /u /c type "!_log!_tmp.log">"!_log!_Debug.log"&del "!_log!_tmp.log" |
||||
@color 07 |
||||
@title %ComSpec% |
||||
@exit /b |
||||
|
||||
:Begin |
||||
title PSFX Repack %uivr% |
||||
pushd "!_work!" |
||||
set _file=(PSFExtractor.exe,cabarc.exe) |
||||
for %%# in %_file% do ( |
||||
if not exist ".\bin\%%#" (set _bin=%%#&goto :E_Bin) |
||||
) |
||||
popd |
||||
if %_Debug% equ 0 @cls |
||||
if not defined _pcab ( |
||||
echo ==== NOTICE ==== |
||||
echo. |
||||
echo Could not detect cab and psf files |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
if %psfnet% equ 0 ( |
||||
echo %_err% |
||||
echo. |
||||
echo PSFExtractor.exe require .NET Framework 4.x or 2.0 |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
if not defined _sdr ( |
||||
echo %_err% |
||||
echo. |
||||
echo Could not find or assign unused Drive Letter |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
set _did=0 |
||||
set _sbst=0 |
||||
set "_tmp=%_drv%\_temp%random%" |
||||
if exist "%_tmp%\" set "_tmp=%_drv%\_temp%random%" |
||||
if not exist "%_tmp%\" mkdir "%_tmp%" |
||||
pushd "!_pcab!" |
||||
for /f "delims=" %%# in ('dir /b *.cab') do (set "pack=%%~n#"&call :psfcab) |
||||
if exist "PSFExtractor.exe" del /f /q "PSFExtractor.*" %_Nul3% |
||||
if exist "cabarc.exe" del /f /q "cabarc.exe" %_Nul3% |
||||
if %_sbst% equ 1 subst %_sdr% /d |
||||
popd |
||||
if exist "%_tmp%\" rmdir /s /q "%_tmp%\" %_Nul3% |
||||
if exist "%_tmp%\" ( |
||||
mkdir %_drv%\_del286 %_Null% |
||||
robocopy %_drv%\_del286 "%_tmp%" /MIR /R:1 /W:1 /NFL /NDL /NP /NJH /NJS %_Null% |
||||
rmdir /s /q %_drv%\_del286\ %_Null% |
||||
rmdir /s /q "%_tmp%\" %_Nul3% |
||||
) |
||||
echo. |
||||
echo Finished |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
|
||||
:psfcab |
||||
if exist "%pack%-full_psfx.cab" exit /b |
||||
if not exist "%pack%.psf" if not exist "%pack:~0,-8%*.psf" ( |
||||
echo %pack%.cab / PSF file is missing or named incorrectly |
||||
exit /b |
||||
) |
||||
if not exist "%pack%.psf" if exist "%pack:~0,-8%*.psf" ( |
||||
for /f %%# in ('dir /b /a:-d "%pack:~0,-8%*.psf"') do rename "%%#" %pack%.psf %_Nul3% |
||||
) |
||||
if exist "%_tmp%\*.mum" del /f /q "%_tmp%\*.mum" %_Nul3% |
||||
if exist "%_tmp%\*.xml" del /f /q "%_tmp%\*.xml" %_Nul3% |
||||
:: expand.exe -f:update.mum "!_pcab!\%pack%.cab" "%_tmp%" %_Null% |
||||
:: if not exist "%_tmp%\update.mum" exit /b |
||||
:: findstr /i /m "PSFX" "%_tmp%\update.mum" %_Nul3% || exit /b |
||||
expand.exe -f:*.psf.cix.xml "!_pcab!\%pack%.cab" "%_tmp%" %_Null% |
||||
if not exist "%_tmp%\*.psf.cix.xml" ( |
||||
echo %pack%.cab / psf.cix.xml file is not found |
||||
exit /b |
||||
) |
||||
if %_did% equ 0 ( |
||||
set _did=1 |
||||
subst %_sdr% "!_pcab!" && (set _sbst=1) || (echo Error: will proceed without subst drive) |
||||
) |
||||
if %_sbst% equ 1 pushd %_sdr% |
||||
if not exist "PSFExtractor.exe" copy /y "!_work!\bin\PSFExtractor.*" . %_Nul3% |
||||
if not exist "cabarc.exe" copy /y "!_work!\bin\cabarc.exe" . %_Nul3% |
||||
echo. |
||||
echo ============================================================ |
||||
echo Extract: %pack%.cab |
||||
echo ============================================================ |
||||
if exist "%pack%\" rmdir /s /q "%pack%\" %_Nul3% |
||||
if not exist "%pack%\" mkdir "%pack%" |
||||
expand.exe -f:* %pack%.cab "%pack%" %_Null% |
||||
if exist "%pack%\*cablist.ini" ( |
||||
expand.exe -f:* "%pack%\*.cab" "%pack%" %_Null% |
||||
del /f /q "%pack%\*cablist.ini" %_Nul3% |
||||
del /f /q "%pack%\*.cab" %_Nul3% |
||||
) |
||||
if not exist "%pack%\express.psf.cix.xml" for /f %%# in ('dir /b /a:-d "%pack%\*.psf.cix.xml"') do rename "%pack%\%%#" express.psf.cix.xml %_Nul3% |
||||
PSFExtractor.exe %pack%.cab %_Null% |
||||
if %errorlevel% neq 0 ( |
||||
echo. |
||||
echo Error: PSFExtractor.exe operation failed |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
) |
||||
echo. |
||||
echo ============================================================ |
||||
echo Create : %pack%-full_psfx.cab |
||||
echo ============================================================ |
||||
cd %pack% |
||||
del /f /q *.psf.cix.xml %_Nul3% |
||||
..\cabarc.exe -m LZX:21 -r -p N ..\psfx2psfx1.cab *.* %_Null% |
||||
if %errorlevel% neq 0 ( |
||||
echo. |
||||
echo Error: cabarc.exe operation failed |
||||
cd.. |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
) |
||||
cd.. |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
ren psfx2psfx1.cab %pack%-full_psfx.cab |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
|
||||
:E_Bin |
||||
echo %_err% |
||||
echo. |
||||
echo Required file is missing: %_bin% |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
|
||||
:E_PS |
||||
echo %_err% |
||||
echo. |
||||
echo Windows PowerShell is required for this script to work. |
||||
echo. |
||||
echo Press any key to exit. |
||||
pause >nul |
||||
goto :eof |
@ -0,0 +1,239 @@
@@ -0,0 +1,239 @@
|
||||
@setlocal DisableDelayedExpansion |
||||
@set uivr=v0.6 |
||||
@echo off |
||||
set _Debug=0 |
||||
|
||||
set "_cmdf=%~f0" |
||||
if exist "%SystemRoot%\Sysnative\cmd.exe" ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
set "_Null=1>nul 2>nul" |
||||
set "_err===== ERROR ====" |
||||
set _pcab= |
||||
set "_args=" |
||||
set "_args=%~1" |
||||
if not defined _args goto :NoProgArgs |
||||
if "%~1"=="" set "_args="&goto :NoProgArgs |
||||
|
||||
:NoProgArgs |
||||
set "SysPath=%SystemRoot%\System32" |
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (set "SysPath=%SystemRoot%\Sysnative") |
||||
set "Path=%SysPath%;%SystemRoot%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\" |
||||
set "xBT=x64" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="arm64" set "xBT=x86" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" set "xBT=x86" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="amd64" set "xBT=x64" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="arm64" set "xBT=x86" |
||||
for /f "tokens=6 delims=[]. " %%# in ('ver') do set winbuild=%%# |
||||
set _pwsh=1 |
||||
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _pwsh=0 |
||||
if %winbuild% geq 22483 if %_pwsh% EQU 0 goto :E_PS |
||||
set "_log=%~dpn0" |
||||
set "_work=%~dp0" |
||||
set "_work=%_work:~0,-1%" |
||||
set _drv=%~d0 |
||||
for /f "skip=2 tokens=2*" %%a in ('reg.exe query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do call set "_dsk=%%b" |
||||
if exist "%PUBLIC%\Desktop\desktop.ini" set "_dsk=%PUBLIC%\Desktop" |
||||
set psfnet=0 |
||||
if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" set psfnet=1 |
||||
if exist "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\ngen.exe" set psfnet=1 |
||||
for %%# in (E F G H I J K L M N O P Q R S T U V W X Y Z) do ( |
||||
set "_adr%%#=%%#" |
||||
) |
||||
if %winbuild% lss 22483 for /f "tokens=2 delims==:" %%# in ('"wmic path Win32_Volume where (DriveLetter is not NULL) get DriveLetter /value" ^| findstr ^=') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
if %winbuild% lss 22483 for /f "tokens=2 delims==:" %%# in ('"wmic path Win32_LogicalDisk where (DeviceID is not NULL) get DeviceID /value" ^| findstr ^=') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
if %winbuild% geq 22483 for /f "tokens=1 delims=:" %%# in ('powershell -nop -c "(([WMISEARCHER]'Select * from Win32_Volume where DriveLetter is not NULL').Get()).DriveLetter; (([WMISEARCHER]'Select * from Win32_LogicalDisk where DeviceID is not NULL').Get()).DeviceID"') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
for %%# in (E F G H I J K L M N O P Q R S T U V W X Y Z) do ( |
||||
if not defined _sdr (if defined _adr%%# set "_sdr=%%#:") |
||||
) |
||||
setlocal EnableDelayedExpansion |
||||
if exist "!_work!\*.cab" if exist "!_work!\*.psf" set "_pcab=!_work!" |
||||
if defined _args if exist "!_args!\*.cab" if exist "!_args!\*.psf" set "_pcab=%~1" |
||||
|
||||
if %_Debug% equ 0 ( |
||||
set "_Nul1=1>nul" |
||||
set "_Nul2=2>nul" |
||||
set "_Nul6=2^>nul" |
||||
set "_Nul3=1>nul 2>nul" |
||||
set "_Pause=pause >nul" |
||||
set "_Contn=echo Press any key to continue..." |
||||
set "_Exit=echo Press any key to exit." |
||||
set "_Supp=" |
||||
goto :Begin |
||||
) |
||||
set "_Nul1=" |
||||
set "_Nul2=" |
||||
set "_Nul6=" |
||||
set "_Nul3=" |
||||
set "_Pause=rem." |
||||
set "_Contn=rem." |
||||
set "_Exit=rem." |
||||
set "_Supp=1>nul" |
||||
copy /y nul "!_work!\#.rw" %_Null% && (if exist "!_work!\#.rw" del /f /q "!_work!\#.rw") || (set "_log=!_dsk!\%~n0") |
||||
echo. |
||||
echo Running in Debug Mode... |
||||
echo The window will be closed when finished |
||||
@echo on |
||||
@prompt $G |
||||
@call :Begin >"!_log!_tmp.log" 2>&1 &cmd /u /c type "!_log!_tmp.log">"!_log!_Debug.log"&del "!_log!_tmp.log" |
||||
@color 07 |
||||
@title %ComSpec% |
||||
@exit /b |
||||
|
||||
:Begin |
||||
title PSFX Repack %uivr% |
||||
pushd "!_work!" |
||||
set _file=(PSFExtractor.exe,DXTool_%xBT%.exe) |
||||
for %%# in %_file% do ( |
||||
if not exist ".\bin\%%#" (set _bin=%%#&goto :E_Bin) |
||||
) |
||||
popd |
||||
if %_Debug% equ 0 @cls |
||||
if not defined _pcab ( |
||||
echo ==== NOTICE ==== |
||||
echo. |
||||
echo Could not detect cab and psf files |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
if %psfnet% equ 0 ( |
||||
echo %_err% |
||||
echo. |
||||
echo PSFExtractor.exe require .NET Framework 4.x or 2.0 |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
if not defined _sdr ( |
||||
echo %_err% |
||||
echo. |
||||
echo Could not find or assign unused Drive Letter |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
set _did=0 |
||||
set _sbst=0 |
||||
set "_tmp=%_drv%\_temp%random%" |
||||
if exist "%_tmp%\" set "_tmp=%_drv%\_temp%random%" |
||||
if not exist "%_tmp%\" mkdir "%_tmp%" |
||||
pushd "!_pcab!" |
||||
for /f "delims=" %%# in ('dir /b *.cab') do (set "pack=%%~n#"&call :psfcab) |
||||
if exist "PSFExtractor.exe" del /f /q "PSFExtractor.*" %_Nul3% |
||||
if exist "DXTool_%xBT%.exe" del /f /q "DXTool_%xBT%.exe" %_Nul3% |
||||
if %_sbst% equ 1 subst %_sdr% /d |
||||
popd |
||||
if exist "%_tmp%\" rmdir /s /q "%_tmp%\" %_Nul3% |
||||
if exist "%_tmp%\" ( |
||||
mkdir %_drv%\_del286 %_Null% |
||||
robocopy %_drv%\_del286 "%_tmp%" /MIR /R:1 /W:1 /NFL /NDL /NP /NJH /NJS %_Null% |
||||
rmdir /s /q %_drv%\_del286\ %_Null% |
||||
rmdir /s /q "%_tmp%\" %_Nul3% |
||||
) |
||||
echo. |
||||
echo Finished |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
|
||||
:psfcab |
||||
if exist "%pack%-full_psfx.cab" exit /b |
||||
if not exist "%pack%.psf" if not exist "%pack:~0,-8%*.psf" ( |
||||
echo %pack%.cab / PSF file is missing or named incorrectly |
||||
exit /b |
||||
) |
||||
if not exist "%pack%.psf" if exist "%pack:~0,-8%*.psf" ( |
||||
for /f %%# in ('dir /b /a:-d "%pack:~0,-8%*.psf"') do rename "%%#" %pack%.psf %_Nul3% |
||||
) |
||||
if exist "%_tmp%\*.mum" del /f /q "%_tmp%\*.mum" %_Nul3% |
||||
if exist "%_tmp%\*.xml" del /f /q "%_tmp%\*.xml" %_Nul3% |
||||
:: expand.exe -f:update.mum "!_pcab!\%pack%.cab" "%_tmp%" %_Null% |
||||
:: if not exist "%_tmp%\update.mum" exit /b |
||||
:: findstr /i /m "PSFX" "%_tmp%\update.mum" %_Nul3% || exit /b |
||||
expand.exe -f:*.psf.cix.xml "!_pcab!\%pack%.cab" "%_tmp%" %_Null% |
||||
if not exist "%_tmp%\*.psf.cix.xml" ( |
||||
echo %pack%.cab / psf.cix.xml file is not found |
||||
exit /b |
||||
) |
||||
if %_did% equ 0 ( |
||||
set _did=1 |
||||
subst %_sdr% "!_pcab!" && (set _sbst=1) || (echo Error: will proceed without subst drive) |
||||
) |
||||
if %_sbst% equ 1 pushd %_sdr% |
||||
if not exist "PSFExtractor.exe" copy /y "!_work!\bin\PSFExtractor.*" . %_Nul3% |
||||
if not exist "DXTool_%xBT%.exe" copy /y "!_work!\bin\DXTool_%xBT%.exe" . %_Nul3% |
||||
echo. |
||||
echo ============================================================ |
||||
echo Extract: %pack%.cab |
||||
echo ============================================================ |
||||
if exist "%pack%\" rmdir /s /q "%pack%\" %_Nul3% |
||||
if not exist "%pack%\" mkdir "%pack%" |
||||
expand.exe -f:* %pack%.cab "%pack%" %_Null% |
||||
if exist "%pack%\*cablist.ini" ( |
||||
expand.exe -f:* "%pack%\*.cab" "%pack%" %_Null% |
||||
del /f /q "%pack%\*cablist.ini" %_Nul3% |
||||
del /f /q "%pack%\*.cab" %_Nul3% |
||||
) |
||||
if not exist "%pack%\express.psf.cix.xml" for /f %%# in ('dir /b /a:-d "%pack%\*.psf.cix.xml"') do rename "%pack%\%%#" express.psf.cix.xml %_Nul3% |
||||
PSFExtractor.exe %pack%.cab %_Null% |
||||
if %errorlevel% neq 0 ( |
||||
echo. |
||||
echo Error: PSFExtractor.exe operation failed |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
) |
||||
echo. |
||||
echo ============================================================ |
||||
echo Create : %pack%-full_psfx.cab |
||||
echo ============================================================ |
||||
del /f /q "%pack%\*.psf.cix.xml" %_Nul3% |
||||
ren %pack%.cab %pack%_bak.cab |
||||
start /WAIT "" DXTool_%xBT%.exe /CT "!cd!\%pack%" |
||||
if exist "%pack%.cab" ( |
||||
ren %pack%.cab %pack%-full_psfx.cab |
||||
ren %pack%_bak.cab %pack%.cab |
||||
) else ( |
||||
echo. |
||||
echo Error: DXTool.exe operation failed |
||||
ren %pack%_bak.cab %pack%.cab |
||||
) |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
|
||||
:E_Bin |
||||
echo %_err% |
||||
echo. |
||||
echo Required file is missing: %_bin% |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
|
||||
:E_PS |
||||
echo %_err% |
||||
echo. |
||||
echo Windows PowerShell is required for this script to work. |
||||
echo. |
||||
echo Press any key to exit. |
||||
pause >nul |
||||
goto :eof |
@ -0,0 +1,238 @@
@@ -0,0 +1,238 @@
|
||||
@setlocal DisableDelayedExpansion |
||||
@set uivr=v0.6 |
||||
@echo off |
||||
set compress=MAX |
||||
:: remove :: from below line to get solid ESD (require high amount of CPU/RAM) |
||||
:: set compress=LZMS |
||||
|
||||
set _Debug=0 |
||||
|
||||
set "_cmdf=%~f0" |
||||
if exist "%SystemRoot%\Sysnative\cmd.exe" ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\Sysnative\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
if exist "%SystemRoot%\SysArm32\cmd.exe" if /i %PROCESSOR_ARCHITECTURE%==AMD64 ( |
||||
setlocal EnableDelayedExpansion |
||||
start %SystemRoot%\SysArm32\cmd.exe /c ""!_cmdf!" %*" |
||||
exit /b |
||||
) |
||||
set "_Null=1>nul 2>nul" |
||||
set "_err===== ERROR ====" |
||||
set _pcab= |
||||
set "_args=" |
||||
set "_args=%~1" |
||||
if not defined _args goto :NoProgArgs |
||||
if "%~1"=="" set "_args="&goto :NoProgArgs |
||||
|
||||
:NoProgArgs |
||||
set "SysPath=%SystemRoot%\System32" |
||||
if exist "%SystemRoot%\Sysnative\reg.exe" (set "SysPath=%SystemRoot%\Sysnative") |
||||
set "Path=%SysPath%;%SystemRoot%;%SysPath%\Wbem;%SysPath%\WindowsPowerShell\v1.0\" |
||||
set "xBT=x64" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="arm64" set "xBT=x86" |
||||
if /i "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" set "xBT=x86" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="amd64" set "xBT=x64" |
||||
if /i "%PROCESSOR_ARCHITEW6432%"=="arm64" set "xBT=x86" |
||||
for /f "tokens=6 delims=[]. " %%# in ('ver') do set winbuild=%%# |
||||
set _pwsh=1 |
||||
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _pwsh=0 |
||||
if %winbuild% geq 22483 if %_pwsh% EQU 0 goto :E_PS |
||||
set "_log=%~dpn0" |
||||
set "_work=%~dp0" |
||||
set "_work=%_work:~0,-1%" |
||||
set _drv=%~d0 |
||||
for /f "skip=2 tokens=2*" %%a in ('reg.exe query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do call set "_dsk=%%b" |
||||
if exist "%PUBLIC%\Desktop\desktop.ini" set "_dsk=%PUBLIC%\Desktop" |
||||
set psfnet=0 |
||||
if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" set psfnet=1 |
||||
if exist "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\ngen.exe" set psfnet=1 |
||||
for %%# in (E F G H I J K L M N O P Q R S T U V W X Y Z) do ( |
||||
set "_adr%%#=%%#" |
||||
) |
||||
if %winbuild% lss 22483 for /f "tokens=2 delims==:" %%# in ('"wmic path Win32_Volume where (DriveLetter is not NULL) get DriveLetter /value" ^| findstr ^=') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
if %winbuild% lss 22483 for /f "tokens=2 delims==:" %%# in ('"wmic path Win32_LogicalDisk where (DeviceID is not NULL) get DeviceID /value" ^| findstr ^=') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
if %winbuild% geq 22483 for /f "tokens=1 delims=:" %%# in ('powershell -nop -c "(([WMISEARCHER]'Select * from Win32_Volume where DriveLetter is not NULL').Get()).DriveLetter; (([WMISEARCHER]'Select * from Win32_LogicalDisk where DeviceID is not NULL').Get()).DeviceID"') do ( |
||||
if defined _adr%%# set "_adr%%#=" |
||||
) |
||||
for %%# in (E F G H I J K L M N O P Q R S T U V W X Y Z) do ( |
||||
if not defined _sdr (if defined _adr%%# set "_sdr=%%#:") |
||||
) |
||||
setlocal EnableDelayedExpansion |
||||
if exist "!_work!\*.cab" if exist "!_work!\*.psf" set "_pcab=!_work!" |
||||
if defined _args if exist "!_args!\*.cab" if exist "!_args!\*.psf" set "_pcab=%~1" |
||||
|
||||
if %_Debug% equ 0 ( |
||||
set "_Nul1=1>nul" |
||||
set "_Nul2=2>nul" |
||||
set "_Nul6=2^>nul" |
||||
set "_Nul3=1>nul 2>nul" |
||||
set "_Pause=pause >nul" |
||||
set "_Contn=echo Press any key to continue..." |
||||
set "_Exit=echo Press any key to exit." |
||||
set "_Supp=" |
||||
goto :Begin |
||||
) |
||||
set "_Nul1=" |
||||
set "_Nul2=" |
||||
set "_Nul6=" |
||||
set "_Nul3=" |
||||
set "_Pause=rem." |
||||
set "_Contn=rem." |
||||
set "_Exit=rem." |
||||
set "_Supp=1>nul" |
||||
copy /y nul "!_work!\#.rw" %_Null% && (if exist "!_work!\#.rw" del /f /q "!_work!\#.rw") || (set "_log=!_dsk!\%~n0") |
||||
echo. |
||||
echo Running in Debug Mode... |
||||
echo The window will be closed when finished |
||||
@echo on |
||||
@prompt $G |
||||
@call :Begin >"!_log!_tmp.log" 2>&1 &cmd /u /c type "!_log!_tmp.log">"!_log!_Debug.log"&del "!_log!_tmp.log" |
||||
@color 07 |
||||
@title %ComSpec% |
||||
@exit /b |
||||
|
||||
:Begin |
||||
title PSFX Repack %uivr% |
||||
pushd "!_work!" |
||||
set _file=(PSFExtractor.exe,imagex_%xBT%.exe) |
||||
for %%# in %_file% do ( |
||||
if not exist ".\bin\%%#" (set _bin=%%#&goto :E_Bin) |
||||
) |
||||
popd |
||||
if %_Debug% equ 0 @cls |
||||
if not defined _pcab ( |
||||
echo ==== NOTICE ==== |
||||
echo. |
||||
echo Could not detect cab and psf files |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
if %psfnet% equ 0 ( |
||||
echo %_err% |
||||
echo. |
||||
echo PSFExtractor.exe require .NET Framework 4.x or 2.0 |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
if not defined _sdr ( |
||||
echo %_err% |
||||
echo. |
||||
echo Could not find or assign unused Drive Letter |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
) |
||||
set _did=0 |
||||
set _sbst=0 |
||||
set "_tmp=%_drv%\_temp%random%" |
||||
if exist "%_tmp%\" set "_tmp=%_drv%\_temp%random%" |
||||
if not exist "%_tmp%\" mkdir "%_tmp%" |
||||
pushd "!_pcab!" |
||||
for /f "delims=" %%# in ('dir /b *.cab') do (set "pack=%%~n#"&call :psfcab) |
||||
if exist "PSFExtractor.exe" del /f /q "PSFExtractor.*" %_Nul3% |
||||
if exist "imagex_%xBT%.exe" del /f /q "imagex_%xBT%.exe" %_Nul3% |
||||
if %_sbst% equ 1 subst %_sdr% /d |
||||
popd |
||||
if exist "%_tmp%\" rmdir /s /q "%_tmp%\" %_Nul3% |
||||
if exist "%_tmp%\" ( |
||||
mkdir %_drv%\_del286 %_Null% |
||||
robocopy %_drv%\_del286 "%_tmp%" /MIR /R:1 /W:1 /NFL /NDL /NP /NJH /NJS %_Null% |
||||
rmdir /s /q %_drv%\_del286\ %_Null% |
||||
rmdir /s /q "%_tmp%\" %_Nul3% |
||||
) |
||||
echo. |
||||
echo Finished |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
|
||||
:psfcab |
||||
if exist "%pack%-full_psfx.esd" exit /b |
||||
if not exist "%pack%.psf" if not exist "%pack:~0,-8%*.psf" ( |
||||
echo %pack%.cab / PSF file is missing or named incorrectly |
||||
exit /b |
||||
) |
||||
if not exist "%pack%.psf" if exist "%pack:~0,-8%*.psf" ( |
||||
for /f %%# in ('dir /b /a:-d "%pack:~0,-8%*.psf"') do rename "%%#" %pack%.psf %_Nul3% |
||||
) |
||||
if exist "%_tmp%\*.mum" del /f /q "%_tmp%\*.mum" %_Nul3% |
||||
if exist "%_tmp%\*.xml" del /f /q "%_tmp%\*.xml" %_Nul3% |
||||
:: expand.exe -f:update.mum "!_pcab!\%pack%.cab" "%_tmp%" %_Null% |
||||
:: if not exist "%_tmp%\update.mum" exit /b |
||||
:: findstr /i /m "PSFX" "%_tmp%\update.mum" %_Nul3% || exit /b |
||||
expand.exe -f:*.psf.cix.xml "!_pcab!\%pack%.cab" "%_tmp%" %_Null% |
||||
if not exist "%_tmp%\*.psf.cix.xml" ( |
||||
echo %pack%.cab / psf.cix.xml file is not found |
||||
exit /b |
||||
) |
||||
if %_did% equ 0 ( |
||||
set _did=1 |
||||
subst %_sdr% "!_pcab!" && (set _sbst=1) || (echo Error: will proceed without subst drive) |
||||
) |
||||
if %_sbst% equ 1 pushd %_sdr% |
||||
if not exist "PSFExtractor.exe" copy /y "!_work!\bin\PSFExtractor.*" . %_Nul3% |
||||
if not exist "imagex_%xBT%.exe" copy /y "!_work!\bin\imagex_%xBT%.exe" . %_Nul3% |
||||
echo. |
||||
echo ============================================================ |
||||
echo Extract: %pack%.cab |
||||
echo ============================================================ |
||||
if exist "%pack%\" rmdir /s /q "%pack%\" %_Nul3% |
||||
if not exist "%pack%\" mkdir "%pack%" |
||||
expand.exe -f:* %pack%.cab "%pack%" %_Null% |
||||
if exist "%pack%\*cablist.ini" ( |
||||
expand.exe -f:* "%pack%\*.cab" "%pack%" %_Null% |
||||
del /f /q "%pack%\*cablist.ini" %_Nul3% |
||||
del /f /q "%pack%\*.cab" %_Nul3% |
||||
) |
||||
if not exist "%pack%\express.psf.cix.xml" for /f %%# in ('dir /b /a:-d "%pack%\*.psf.cix.xml"') do rename "%pack%\%%#" express.psf.cix.xml %_Nul3% |
||||
PSFExtractor.exe %pack%.cab %_Null% |
||||
if %errorlevel% neq 0 ( |
||||
echo. |
||||
echo Error: PSFExtractor.exe operation failed |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
) |
||||
echo. |
||||
echo ============================================================ |
||||
echo Create : %pack%-full_psfx.esd |
||||
echo ============================================================ |
||||
del /f /q "%pack%\*.psf.cix.xml" %_Nul3% |
||||
imagex_%xBT%.exe /CAPTURE "%pack%" "%pack%-full_psfx.esd" "%pack%" "%pack%" /COMPRESS %compress% /NORPFIX /NOACL ALL /NOTADMIN /TEMP "%temp%" |
||||
if %errorlevel% neq 0 ( |
||||
echo. |
||||
echo Error: imagex.exe operation failed |
||||
) |
||||
rmdir /s /q "%pack%\" %_Nul3% |
||||
if %_sbst% equ 1 popd |
||||
exit /b |
||||
|
||||
:E_Bin |
||||
echo %_err% |
||||
echo. |
||||
echo Required file is missing: %_bin% |
||||
echo. |
||||
%_Exit% |
||||
%_Pause% |
||||
goto :eof |
||||
|
||||
:E_PS |
||||
echo %_err% |
||||
echo. |
||||
echo Windows PowerShell is required for this script to work. |
||||
echo. |
||||
echo Press any key to exit. |
||||
pause >nul |
||||
goto :eof |
Loading…
Reference in new issue