@echo off setlocal EnableDelayedExpansion set workdir=%~dp0 set tweakdir=%workdir%tweaks cd /d %workdir% :: expanding path with prerequisites for /d %%i in ("bin\*") do set path=%cd%\%%i;!path! :: clearing temporary data if exist "tmp" ( echo. echo -- unmounting registry -- reg unload HKLM\OPUS-NT_TMP echo. echo. echo -- unmounting windows image -- dism /unmount-image /mountdir:"tmp\wim" /discard echo. echo. echo -- removing tmp folder -- rmdir "tmp" /s /q echo. ) if "%1" == "" ( echo usage: create-iso.bat IMAGE goto exit ) :: console mode if "%1" == "console" ( echo. cmd goto exit ) mkdir tmp echo. echo. echo -- extracting iso -- mkdir tmp\disc-image 7z x -o"tmp\disc-image" "%1" echo. echo. echo -- mounting wmi -- dism /get-imageinfo /imagefile:"tmp\disc-image\sources\install.wim" set /p "index=index: " mkdir tmp\wim dism /mount-image /index:%index% /imagefile:"tmp\disc-image\sources\install.wim" /mountdir:"tmp\wim" :: image console mode if "%2" == "console" ( echo. cmd goto exit ) echo. echo. echo -- applying files to windows image -- for /d %%t in ("%tweakdir%\*") do ( call "applyTweakWim.bat" "%%t" ) echo. echo. echo -- working registry -- for %%r in (tmp\wim\windows\system32\config\*) do ( echo. echo mounting: %%~nr reg load HKLM\OPUS-NT_TMP "%%r" echo. echo running tweaks for %%~nr... for /d %%t in ("%tweakdir%\*") do ( call "applyTweakReg.bat" "%%t" "%%r" ) echo unmounting: %%r reg unload HKLM\OPUS-NT_TMP ) :: why would the default user settings not be in %windir%\system32\config? echo. echo mounting: tmp\wim\Users\Default\NTUSER.DAT reg load HKLM\OPUS-NT_TMP "tmp\wim\Users\Default\NTUSER.DAT" echo running tweaks for NTUSER... for /d %%t in ("%tweakdir%\*") do ( call "applyTweakReg.bat" "%%t" "NTUSER" ) echo unmounting: tmp\wim\Users\Default\NTUSER.DAT reg unload HKLM\OPUS-NT_TMP echo. echo. echo -- applying scripts -- for /d %%t in ("%tweakdir%\*") do ( call "applyTweakScript.bat" "%%t" ) echo. echo. echo -- committing changes to wim and unmounting -- dism /unmount-image /mountdir:"tmp\wim" /commit echo. echo. echo -- applying files to disc-image -- for /d %%t in ("%tweakdir%\*") do ( call "applyTweakIso.bat" "%%t" ) echo. echo -- moving disc-image folder -- rmdir "disc-image" /s /q move "tmp\disc-image" "%cd%" echo. echo -- deleting tmp -- rmdir "tmp" /s /q echo. echo all done. a folder with the disc image's data has been created. use something like ntlite to compile it into an iso. pause explorer.exe "%cd%\disc-image" goto exit :exit