Thank you! This saved me from more frustrating experimentation, as I was going to remove components from stock 21H2 Win 10 Pro and then try to update using Windows Update. I see now that getting Windows Update to work would be more involved. For the background - I'm trying to trim down deployed windows size as much as possible to run on a Chromebook with only 16GB eMMC drive (that is soldered on to the motherboard). Without MSMG tool - I trimmed regular windows installation to about 10GB after all the updates (disable hibernation, disable swap, turn on OS compression, run dism cleanup after updates), which left 5GB for data and programs. Sounds like it would be best to disable Update if I want to trim windows more by removing components (which is probably fine for that Chromebook use case, can just periodically reinstall OS with new feature updates).
Hello! People Kind help me please, is it possible to remake the code in this script so that the WA-Addons from abbodi1406 are in a folder called addon and unpacked there, into the addon folder? Help me please. Spoiler: script for unpackeds WA-Addons from abbodi1406 Code: cd /d "%~dp0" set /a _t=0 set /a _c=0 if exist "*.WA" for /f "delims=" %%# in ('dir /b /os *.WA') do call set /a _t+=1 if %_t% equ 0 exit /b for /f "delims=" %%# in ('dir /b /os *.WA') do (set "addon=%%#"&set "dest=%%~n#"&call repare) echo. echo Done. echo Press any key to exit. pause >nul exit /b repare if exist "%dest%" ( if exist "%dest%\Registry\NSudoC.exe" (exit /b) else (rd /s /q "%dest%") ) set /a _c+=1 echo %_c%/%_t%: %addon% echo. bin\7zr x "%addon%" -o"%dest%" * -r >nul if not exist "%dest%\Tasks.txt" rd /s /q "%dest%"&exit /b md "%dest%\Registry\" copy /y bin\NSudoC.exe "%dest%\Registry\" >nul copy /y bin\Integrator.cmd "%dest%\" >nul copy /y bin\Reg2Wim.cmd "%dest%\" >nul pushd "%dest%\" findstr /i ".dll" Tasks.txt >nul && for /f "tokens=1,2 delims=:" %%a in ('findstr /i ".dll" Tasks.txt') do ( if not exist "Files\%%b" md "Files\%%b" move /y "%%a" "Files\%%b\" >nul ) for /f "tokens=1,2 delims=:" %%a in ('findstr /i ":" Tasks.txt ^|findstr /i /v ".dll"') do ( if not exist "Files\%%b" md "Files\%%b" move /y "%%a" "Files\%%b\" >nul ) for /f "delims=" %%# in ('dir /b *.reg') do call Reg2Wim.cmd %%# move /y *.reg Registry\ >nul del /f /q Reg2Wim.cmd Tasks.txt popd exit /b
Where the code should work in the addons folder start the code using: Maybe set "addons=%~dp0addons" cd /d "%addons%" At the end of the block return to the script root folder with: cd /d "%~dp0" or use pushd popd Or I did not understand it right, what would be your question.
hi, it is sed that you should not use dism and tk ways to remove packages one after another, only one could someone explain why? also is it possible to use dism and tk and a thurd party tool for the components that are not as yet supported by the toolkit? tk stands for toolkit. least for me. thanks for your answers in advanse
@MSMG, There is an optimization command to avoid the need to export to the Temp folder and move back. With the "Wimlib-Imagex optimize" command, there is the display of size info, from before and after optimization. But with the "Wimlib-Imagex export" command, the display of this information does not occur. Code: echo.------------------------------------------------------------------------------- echo.####Optimizing Source WIM Image################################################ echo.------------------------------------------------------------------------------- rem call :ExportImage "%InstallWim%", "%Temp%\rebuild.wim", "WIM", "No" echo. %WimlibImagex% export "%InstallWim%" all "%Temp%\rebuild.wim" --compress=LZX echo. move /y "%Temp%\rebuild.wim" "%InstallWim%" >nul echo.------------------------------------------------------------------------------- echo.####Finished Optimizing Source WIM Image####################################### echo.------------------------------------------------------------------------------- I put the "optimize" command because I prefer to see this image size information. Then, as a curiosity, follows the "optimize" command block: Code: echo.------------------------------------------------------------------------------- echo.####Optimizing Source WIM Image################################################ echo.------------------------------------------------------------------------------- rem call :ExportImage "%InstallWim%", "%_TMP%\rebuildinstall.wim", "WIM", "No", %CompressParam% echo. if exist "%InstallWim%" %WimLibImagex% optimize "%InstallWim%" echo. echo.------------------------------------------------------------------------------- echo.####Finished Optimizing Source WIM Image####################################### echo.------------------------------------------------------------------------------- Optimize may be interesting to use in "boot.wim" and "winre.wim" and if "%TrimEditions%" equ "No" for "install.wim". But it will be with image size information before and after optimization. Spoiler: Wimlib-Imagex export Code: ------------------------------------------------------------------------------- Optimizing Source [install.wim Image] with Maximum Compression... ------------------------------------------------------------------------------- Using LZX compression with 8 threads Archiving file data: 11 GiB of 11 GiB (100%) done ------------------------------------------------------------------------------- ####Finished Optimizing Source WIM Image####################################### ------------------------------------------------------------------------------- Spoiler: Wimlib-Imagex optmize Code: ------------------------------------------------------------------------------- Optimizing Source [boot.wim] Image with Maximum Compression... ------------------------------------------------------------------------------- "C:\TK\InstallMedia\sources\boot.wim" original size: 562343 KiB Using LZX compression with 8 threads Archiving file data: 1303 MiB of 1303 MiB (100%) done Calculating integrity table for WIM: 548 MiB of 548 MiB (100%) done "C:\TK\InstallMedia\sources\boot.wim" optimized size: 561684 KiB Space saved: 659 KiB ------------------------------------------------------------------------------- Optimizing Source [install.wim Image] with Maximum Compression... ------------------------------------------------------------------------------- "C:\TK\InstallMedia\sources\install.wim" original size: 5876661 KiB Using LZX compression with 8 threads Archiving file data: 11 GiB of 11 GiB (100%) done Calculating integrity table for WIM: 5731 MiB of 5731 MiB (100%) done "C:\TK\InstallMedia\sources\install.wim" optimized size: 5869185 KiB Space saved: 7475 KiB ------------------------------------------------------------------------------- ####Finished Optimizing Source WIM Image####################################### ------------------------------------------------------------------------------- In :ExtractSourceStoreESD label In this case of "boot.wim", for Capture Image, should the argument to "call :CaptureImage" be "Yes"? from: Code: call :CaptureImage "%BootWim%", "%Temp%\ESD", "BootWim", "BootWim", "No" >nul to: Code: call :CaptureImage "%BootWim%", "%Temp%\ESD", "BootWim", "BootWim", "Yes" >nul And, you did not implement Wimlib-Imagex commands. As friend @mhussain said, it would be interesting to be able to use a list to RemovePkgsList for DISM and another for ToolkitHelper, without having to exclude one to use the other. I think it is simpler to add to DISM because just add a line and change the use code for the list. add: Code: set "RemovePkgsList_DISM=%Lists%\RemovePkgsList_DISM.txt" change from: Code: if "%RemovalMethod%" equ "DISM" ( for /f %%z IN ('"type %RemovePkgsList%" 2^>nul') do ( call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z ) ) if "%RemovalMethod%" equ "ToolKitHelper" ( echo. %ToolKitHelper% "%InstallMount%\%%i" "%RemovePkgsList%" echo. ) to: Code: if "%RemovalMethod%" equ "DISM" ( for /f "eol=# tokens=*" %%z in ('type "%RemovePkgsList_DISM%" 2^>nul') do ( call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z ) ) if "%RemovalMethod%" equ "ToolkitHelper" ( set Components= for /f "eol=# tokens=*" %%z in ('type "%RemovePkgsList%" 2^>nul') do ( set "Components=!Components!,%%z" ) set "Components=!Components:~1!" echo. echo. %ToolKitHelper% "%InstallMount%\%%i" "!Components!" set Components= ) And, put a for loop with eol=#, in RemovalMethod=ToolkitHelper, so that the guys can comment (mark with # at the beginning of the line the components that must remain) on the list instead of excluding components from it. This makes it easier to edit the Custom Lists. EDITED
Sensational. Excellent modifications and optimizations. Congratulations Stays like this:? Code: echo.####Removing Windows Components Using Package List############################# echo.------------------------------------------------------------------------------- for /l %%i in (1, 1, %ImageCount%) do ( if exist "%InstallMount%\%%i" ( echo. if not %%i gtr 9 echo.===========================[Install.wim, Index : %%i]============================ if %%i gtr 9 echo.==========================[Install.wim, Index : %%i]============================ if "%RemovalMethod%" equ "DISM" ( for /f "eol=# tokens=*" %%z in ('type "%RemovePkgsList_DISM%" 2^>nul') do ( call :RemoveLockedPackage "%InstallMount%\%%i", %%z, %%z ) ) if "%RemovalMethod%" equ "ToolkitHelper" ( set Components= for /f "eol=# tokens=*" %%z in ('type "%RemovePkgsList%" 2^>nul') do ( set "Components=!Components!,%%z" ) echo. echo. %ToolKitHelper% "%InstallMount%\%%i" "!Components!" set Components= ) ) ) echo.------------------------------------------------------------------------------- echo.####Finished Removing Windows Components Using Package List#################### echo.-------------------------------------------------------------------------------
Code: set "Componentes=!Componentes!,%%z" set "Componentes=!Componentes:~1!" echo.!Componentes! set "Componentes=!Componentes! %%z" echo.!Componentes! ?
@Bira, That way, there is still a blank space at the beginning. Code: set "Componentes=!Componentes! %%z" echo.!Componentes! So I would still need this, only for the aesthetics of the output: Code: set "Components=!Components:~1!" Yes. But I added the line that Bira reminded me. Edited, in the previous post.
relax that even with this space it does, oh it can be; , or spaces in the loop or not, but rather leave it with ~1 to break the ;, or spaces
Yes. It is something aesthetic for the output, because in "for" command and some other commands, the compiler will interpret, spaces, commas, semicolon as space. But also, in this case, the space will be ignored, so inserting this line is really for aesthetics.
@MSMG, from: Code: %WimlibImagex% export "%BootWim%" all "%Temp%\rebuild.wim" --compress=LZX to: Code: %WimlibImagex% export "%BootWim%" all "%Temp%\rebuild.wim" --compress=LZX --boot or the optimize command: Code: %WimlibImagex% optimize "%BootWim%"
MicrosoftWindows.Client.Core_cw5n1h2txyewy related to Start Menu Taskbar Snap Layout File Explorer Extensions System Tray Kind of Windows feature experience pack.