@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 if not "%errorlevel%" == "0" ( echo. echo could not remove tmp-folder, canceling pause goto exit ) 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\iso 7z x -o"tmp\iso" "%1" if not "%errorlevel%" == "0" ( echo. echo could not extract iso, canceling pause goto exit ) echo. echo. echo -- mounting wmi -- dism /get-imageinfo /imagefile:"tmp\iso\sources\install.wim" if not "%errorlevel%" == "0" ( echo. echo could not get image info, canceling pause goto exit ) set /p "index=index: " mkdir tmp\wim dism /mount-image /index:%index% /imagefile:"tmp\iso\sources\install.wim" /mountdir:"tmp\wim" if not "%errorlevel%" == "0" ( echo. echo could not mount image, canceling pause goto exit ) :: 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. if "%errorlevel%" == "0" ( 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" if "%errorlevel%" == "0" ( 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 if not "%errorlevel%" == "0" ( echo. echo could not unmount image, canceling pause goto exit ) echo. echo. echo -- applying files to iso folder -- for /d %%t in ("%tweakdir%\*") do ( call "applyTweakIso.bat" "%%t" ) echo. echo -- moving iso folder -- rmdir "iso" /s /q move "tmp\iso" "%cd%" echo. echo -- deleting tmp -- rmdir "tmp" /s /q echo. echo all done. a folder with the disc image's data has been created in \iso\. use something like ntlite to compile it into an iso. pause goto exit :exit