diff --git a/OfficeMSPs/Extract_MSP_KB.cmd b/OfficeMSPs/Extract_MSP_KB.cmd deleted file mode 100644 index 6e214c2..0000000 --- a/OfficeMSPs/Extract_MSP_KB.cmd +++ /dev/null @@ -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 \ No newline at end of file diff --git a/OfficeMSPs/Extract_Msp_Office.cmd b/OfficeMSPs/Extract_Msp_Office.cmd new file mode 100644 index 0000000..38f6cb1 --- /dev/null +++ b/OfficeMSPs/Extract_Msp_Office.cmd @@ -0,0 +1,240 @@ + + + + + + \ No newline at end of file diff --git a/OfficeMSPs/README.md b/OfficeMSPs/README.md index 348957e..6811230 100644 --- a/OfficeMSPs/README.md +++ b/OfficeMSPs/README.md @@ -1,28 +1,27 @@ # Organize Office MSP Updates -* Extract and prepare Office msp files from global exe update files, and rename them uniquely per KB number +* Extract and prepare Office msp files from global exe/cab update files to a folder with meaningful names. -* Mainly ment for Office 2010 to avoid confliction between neutral update and multilingual update for same product +* The MSP files will be renamed with prefix `Y_` or `Z_` followed by the package name, KB ID, Arch and MSP file name. ## Variables: -- "EXEFOL" the path to parent office updates folder +- "dirOfEXE" the path to parent office updates folder -- "MSPFOL" extracted MSP files path, default is 'MSPs' folder next to the script +- "dirOfMSP" extracted MSP files path, default is 'MSPs' folder next to the script -- "LANG" the locale to be kept. Leaving it empty will keep all locales. +- "OldMSPdir" Folder to move old MSP versions, default is 'OLD' inside dirOfMSP -- "PROOFLANG" the companion [proofing languages](https://technet.microsoft.com/en-us/library/ee942198(office.14).aspx). Leaving it empty will only keep the above locale patch. +- "langOfMSP" language files to keep. Leaving it empty will keep all langs. -## Last Step +- "ProofLang" comma separated companion proofing languages. Leaving it empty will keep all proof msp files. +[Office 2010](https://technet.microsoft.com/en-us/library/ee942198(office.14).aspx) +[Office 2013](https://technet.microsoft.com/en-us/library/ee942198(office.15).aspx) +Office 2016: Not needed, Proof msp update contain all languages -After the process is completed, manually delete msp files that have newer similar files (based on timestamps) - -example: +## Remark -z_word2010-kb2965313-x86.msp <- delete - -z_word2010-kb3128034-x86.msp <- keep +After the process is completed, manually delete msp files that have newer similar files (based on timestamps) ## Credits: diff --git a/PSFX_MSU/PSFX2MSU.cmd b/PSFX_MSU/PSFX2MSU.cmd new file mode 100644 index 0000000..afacb76 --- /dev/null +++ b/PSFX_MSU/PSFX2MSU.cmd @@ -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 diff --git a/PSFX_MSU/README.md b/PSFX_MSU/README.md new file mode 100644 index 0000000..b76779f --- /dev/null +++ b/PSFX_MSU/README.md @@ -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 diff --git a/PSFX_Repack/README.md b/PSFX_Repack/README.md new file mode 100644 index 0000000..e7baa0d --- /dev/null +++ b/PSFX_Repack/README.md @@ -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/) diff --git a/PSFX_Repack/bin/DXTool_x64.exe b/PSFX_Repack/bin/DXTool_x64.exe new file mode 100644 index 0000000..0e0b9b5 Binary files /dev/null and b/PSFX_Repack/bin/DXTool_x64.exe differ diff --git a/PSFX_Repack/bin/DXTool_x86.exe b/PSFX_Repack/bin/DXTool_x86.exe new file mode 100644 index 0000000..67dbe5a Binary files /dev/null and b/PSFX_Repack/bin/DXTool_x86.exe differ diff --git a/PSFX_Repack/bin/PSFExtractor.exe b/PSFX_Repack/bin/PSFExtractor.exe new file mode 100644 index 0000000..be5fede Binary files /dev/null and b/PSFX_Repack/bin/PSFExtractor.exe differ diff --git a/PSFX_Repack/bin/PSFExtractor.exe.config b/PSFX_Repack/bin/PSFExtractor.exe.config new file mode 100644 index 0000000..ec35130 --- /dev/null +++ b/PSFX_Repack/bin/PSFExtractor.exe.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/PSFX_Repack/bin/cabarc.exe b/PSFX_Repack/bin/cabarc.exe new file mode 100644 index 0000000..a757a94 Binary files /dev/null and b/PSFX_Repack/bin/cabarc.exe differ diff --git a/PSFX_Repack/bin/imagex_x64.exe b/PSFX_Repack/bin/imagex_x64.exe new file mode 100644 index 0000000..8fee643 Binary files /dev/null and b/PSFX_Repack/bin/imagex_x64.exe differ diff --git a/PSFX_Repack/bin/imagex_x86.exe b/PSFX_Repack/bin/imagex_x86.exe new file mode 100644 index 0000000..e1e0700 Binary files /dev/null and b/PSFX_Repack/bin/imagex_x86.exe differ diff --git a/PSFX_Repack/psfx2cab_CLI.cmd b/PSFX_Repack/psfx2cab_CLI.cmd new file mode 100644 index 0000000..33b811e --- /dev/null +++ b/PSFX_Repack/psfx2cab_CLI.cmd @@ -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 diff --git a/PSFX_Repack/psfx2cab_GUI.cmd b/PSFX_Repack/psfx2cab_GUI.cmd new file mode 100644 index 0000000..4aad865 --- /dev/null +++ b/PSFX_Repack/psfx2cab_GUI.cmd @@ -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 diff --git a/PSFX_Repack/psfx2esd_CLI.cmd b/PSFX_Repack/psfx2esd_CLI.cmd new file mode 100644 index 0000000..40005f0 --- /dev/null +++ b/PSFX_Repack/psfx2esd_CLI.cmd @@ -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 diff --git a/README.md b/README.md index 8780185..fdd0208 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,25 @@ |:--|-- |**BatUtil**|Collection of batch scripts utilities for Windows. For download releases, see [here](https://github.com/abbodi1406/WHD/tree/master/scripts)| |**W10UI**|Windows 10 Updates Installer. Install/integrate Windows 10 Updates.| -|**WHD-W7UI**|Windows 7 Updates Installer. Install/integrate Windows 7 Updates, depending on WHDownloader repository.| |**WHD-W8.1UI**|Windows 8.1 Updates Installer. Install/integrate Windows 8.1 Updates, depending on WHDownloader repository.| +|**WHD-W7UI**|Windows 7 Updates Installer. Install/integrate Windows 7 Updates, depending on WHDownloader repository.| +|**W81ESUI**|Standalone Installer for Windows 8.1 / Embedded / Server 2012 R2 Extended Security Updates.| +|**W7ESUI**|Standalone Installer for Windows 7 / Embedded / Server 2008 R2 Extended Security Updates.| |**EdgeChromiumInstaller**|Install Microsoft Edge (Chromium) offline with working Edge Update| |**uup-converter-wimlib**| UUP -> ISO Converter ft. WimLib. Process and convert Microsoft Windows 10 Unified Update Platform files into a usable state (ISO / WIM). |**esd-decrypter-wimlib**|ESD -> ISO Decrypter ft. WimLib. Process and convert Microsoft Windows 10 full ESD files (encrypted or decrypted) into a usable state (ISO / WIM / decrypted ESD). -|**YAOCTRI**|Yet Another Office Click-To-Run Installer. Install Office 2016/2019 ClickToRun from offline source without using Office Deployment Tool (setup.exe). -|**OfficeC2R-R2V**|Office Click-to-Run Retail-to-Volume. Convert Office 2016/2019 ClickToRun licensing from Retail to Volume, which then can be activated easily using various KMS solutions.| -|**OfficeScrubber**|Uninstall, remove and scrub Office 2016 MSI and Office Click-to-Run (2016, 2019, 365).| -|**OfficeMSPs**|Office MSP Updates Organizer. Extract and prepare Office 2010/2013/2016 msp files from global exe update files, and rename them uniquely per KB number.| -|**OfficeUpdates**|Installer for Microsoft Office Updates. Install MSI-based Office 2010/2013/2016 updates directly from global exe files.| -|**W7MUI**|Windows 7 Multilingual Distribution Creator. Add language packs to Windows 7 distribution, resulting a multilingual ISO/WIM.| -|**W8.1MUI**|Windows 8.1 Multilingual Distribution Creator. Add language packs to Windows 8.1 distribution, resulting a multilingual ISO/WIM.| +|**YAOCTRI**|Yet Another Office Click-To-Run Installer. Install Office Click To Run from offline source without using Office Deployment Tool (setup.exe). +|**OfficeC2R-R2V**|Office Click To Run 365/2021/2019/2016/2013 licensing converter from Retail to Volume.| +|**OfficeScrubber**|Scrub/Remove Office (MSI or Click-to-Run), from 2003 to 2021.| +|**OfficeMSPs**|Office MSP Updates Organizer. Extract and prepare Office msp files from global exe/cab update files to a folder with meaningful names.| +|**OfficeUpdates**|Installer for Microsoft Office Updates. Install MSI-based Office 2010/2013/2016 updates directly from exe/cab/msp files.| |**W10MUI**|Windows 10 Multilingual Distribution Creator. Add language packs to Windows 10 distribution, resulting a multilingual ISO/WIM.| +|**W8.1MUI**|Windows 8.1 Multilingual Distribution Creator. Add language packs to Windows 8.1 distribution, resulting a multilingual ISO/WIM.| +|**W7MUI**|Windows 7 Multilingual Distribution Creator. Add language packs to Windows 7 distribution, resulting a multilingual ISO/WIM.| |**ESD2CAB-CAB2ESD**|Convert Windows 10 UUP's ESD files to CAB files and vice versa| |**ESD2WIM-WIM2ESD**|Convert Solid-compressed ESD file to a Regular-compressed WIM file and vice versa.| |**ActionListUUP**|Create ActionList.xml file to be used with WindowsUpdateBox.exe to directly upgrade from Windows 10 UUP files set.| |**WinDLS**|Windows Display Language Switcher. Install and change "Display Language" for Windows Editions (SKUs) that are not alllowed to have multiple languages by default.| |**Win81Bing**|Convert leaked Windows 8.1 with Bing ISOs to other languages.| +|**PSFX_MSU**|Create Windows 11 LCU MSU file out of the UUP update files.| +|**PSFX_Repack**|Extract PSFX format psf/cab files, and repackage into a full cab or esd file.| diff --git a/YAOCTRI/YAOCTRIR_Configurator.cmd b/YAOCTRI/YAOCTRIR_Configurator.cmd index 1d02a43..aacdcef 100644 --- a/YAOCTRI/YAOCTRIR_Configurator.cmd +++ b/YAOCTRI/YAOCTRIR_Configurator.cmd @@ -1578,11 +1578,11 @@ reg add %_Config% /f /v %%J.OSPPReady /t REG_SZ /d 1 exit /b :Telemetry -set "_inter=Software" -if %wow64%==1 (set "_inter=Software\Wow6432Node") -set "_rkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings" -set "_skey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\16.0" -set "_tkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" +set "_inter=SOFTWARE" +if %wow64%==1 (set "_inter=SOFTWARE\Wow6432Node") +set "_rkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings" +set "_skey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\16.0" +set "_tkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" for %%# in (Count,Order) do reg add "%_rkey%" /f /v %%# /t REG_DWORD /d 1 reg add "%_tkey%" /f /v SendTelemetry /t REG_DWORD /d 3 reg add "%_tkey%" /f /v DisableTelemetry /t REG_DWORD /d 1 diff --git a/YAOCTRI/YAOCTRIR_Installer.cmd b/YAOCTRI/YAOCTRIR_Installer.cmd index 4c73342..c1a8889 100644 --- a/YAOCTRI/YAOCTRIR_Installer.cmd +++ b/YAOCTRI/YAOCTRIR_Installer.cmd @@ -425,11 +425,11 @@ reg add %_Config% /f /v %%J.OSPPReady /t REG_SZ /d 1 exit /b :Telemetry -set "_inter=Software" -if /i %xOS%==x64 if %wow64%==1 (set "_inter=Software\Wow6432Node") -set "_rkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings" -set "_skey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\16.0" -set "_tkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" +set "_inter=SOFTWARE" +if /i %xOS%==x64 if %wow64%==1 (set "_inter=SOFTWARE\Wow6432Node") +set "_rkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings" +set "_skey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\16.0" +set "_tkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" for %%# in (Count,Order) do reg add "%_rkey%" /f /v %%# /t REG_DWORD /d 1 reg add "%_tkey%" /f /v SendTelemetry /t REG_DWORD /d 3 reg add "%_tkey%" /f /v DisableTelemetry /t REG_DWORD /d 1 diff --git a/YAOCTRI/YAOCTRI_Configurator.cmd b/YAOCTRI/YAOCTRI_Configurator.cmd index c5813a6..92297da 100644 --- a/YAOCTRI/YAOCTRI_Configurator.cmd +++ b/YAOCTRI/YAOCTRI_Configurator.cmd @@ -1364,11 +1364,11 @@ reg add %_Config% /f /v %%J.OSPPReady /t REG_SZ /d 1 exit /b :Telemetry -set "_inter=Software" -if %wow64%==1 (set "_inter=Software\Wow6432Node") -set "_rkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings" -set "_skey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\16.0" -set "_tkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" +set "_inter=SOFTWARE" +if %wow64%==1 (set "_inter=SOFTWARE\Wow6432Node") +set "_rkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings" +set "_skey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\16.0" +set "_tkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" for %%# in (Count,Order) do reg add "%_rkey%" /f /v %%# /t REG_DWORD /d 1 reg add "%_tkey%" /f /v SendTelemetry /t REG_DWORD /d 3 reg add "%_tkey%" /f /v DisableTelemetry /t REG_DWORD /d 1 diff --git a/YAOCTRI/YAOCTRI_Installer.cmd b/YAOCTRI/YAOCTRI_Installer.cmd index e9afb5b..052c2fa 100644 --- a/YAOCTRI/YAOCTRI_Installer.cmd +++ b/YAOCTRI/YAOCTRI_Installer.cmd @@ -440,11 +440,11 @@ reg add %_Config% /f /v %%J.OSPPReady /t REG_SZ /d 1 exit /b :Telemetry -set "_inter=Software" -if /i %xOS%==x64 if %wow64%==1 (set "_inter=Software\Wow6432Node") -set "_rkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings" -set "_skey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\16.0" -set "_tkey=%_CTR%\REGISTRY\MACHINE\%_inter%\Microsoft\Office\16.0\User Settings\CustomSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" +set "_inter=SOFTWARE" +if /i %xOS%==x64 if %wow64%==1 (set "_inter=SOFTWARE\Wow6432Node") +set "_rkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings" +set "_skey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\16.0" +set "_tkey=HKLM\%_inter%\Microsoft\Office\16.0\User Settings\MyCustomUserSettings\Create\Software\Microsoft\Office\Common\ClientTelemetry" for %%# in (Count,Order) do reg add "%_rkey%" /f /v %%# /t REG_DWORD /d 1 reg add "%_tkey%" /f /v SendTelemetry /t REG_DWORD /d 3 reg add "%_tkey%" /f /v DisableTelemetry /t REG_DWORD /d 1