diff --git a/windick.cmd b/windick.cmd index 00bd2bb..584bfdf 100644 --- a/windick.cmd +++ b/windick.cmd @@ -2,14 +2,14 @@ ::Build, administrate and backup your Windows in a native WinPE recovery environment. @ECHO OFF&&SETLOCAL ENABLEDELAYEDEXPANSION&&CHCP 437>NUL&&SET "VER_GET=%0"&&CALL:VER_GET&&SET "ORIG_CD=%CD%"&&CD /D "%~DP0"&&SET "ARG0=%*" Reg.exe query "HKU\S-1-5-19\Environment">NUL -IF NOT "%ERRORLEVEL%" EQU "0" ECHO.Right-Click ^& Run As Administrator&&PAUSE&&GOTO:CLEAN_EXIT +IF NOT "%ERRORLEVEL%" EQU "0" ECHO.Right-Click ^& Run As Administrator&&PAUSE&&GOTO:QUIT FOR /F "TOKENS=*" %%a in ('ECHO.%CD%') DO (SET "CAPS_SET=PROG_FOLDER"&&SET "CAPS_VAR=%%a"&&CALL:CAPS_SET) SET "CHAR_STR=%PROG_FOLDER%"&&SET "CHAR_CHK= "&&CALL:CHAR_CHK -IF DEFINED CHAR_FLG ECHO.ERROR: Remove the space from the path or folder name, then launch again.&&PAUSE&&GOTO:CLEAN_EXIT -IF "%PROG_FOLDER%"=="%SYSTEMDRIVE%\WINDOWS\SYSTEM32" ECHO.ERROR: Invalid path or folder name. Relocate, then launch again.&&PAUSE&&GOTO:CLEAN_EXIT +IF DEFINED CHAR_FLG ECHO.ERROR: Remove the space from the path or folder name, then launch again.&&PAUSE&&GOTO:QUIT +IF "%PROG_FOLDER%"=="%SYSTEMDRIVE%\WINDOWS\SYSTEM32" ECHO.ERROR: Invalid path or folder name. Relocate, then launch again.&&PAUSE&&GOTO:QUIT FOR /F "TOKENS=1-9 DELIMS=\" %%a IN ("%PROG_FOLDER%") DO (IF "%%a\%%b\%%c"=="%SystemDrive%\WINDOWS\TEMP" SET "PATH_FAIL=1" IF "%%a\%%b\%%d\%%e\%%f"=="%SystemDrive%\USERS\APPDATA\LOCAL\TEMP" SET "PATH_FAIL=1") -IF DEFINED PATH_FAIL ECHO.ERROR: This should not be run from a temp folder. Extract zip into a new folder, then launch again.&&PAUSE&&GOTO:CLEAN_EXIT +IF DEFINED PATH_FAIL ECHO.ERROR: This should not be run from a temp folder. Extract zip into a new folder, then launch again.&&PAUSE&&GOTO:QUIT FOR %%1 in (1 2 3 4 5 6 7 8 9) DO (CALL SET "ARG%%1=%%%%1%%") FOR %%1 in (1 2 3 4 5 6 7 8 9) DO (IF DEFINED ARG%%1 SET "ARGZ=%%1"&&CALL SET "ARGX=%%ARG%%1%%"&&CALL:ARGUE) IF DEFINED ARG1 FOR %%G in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( @@ -19,14 +19,14 @@ CALL:MOUNT_INT&&IF DEFINED ARG1 SET "PROG_MODE=COMMAND"&&GOTO:COMMAND_MODE FOR /F "TOKENS=1 DELIMS=: " %%a IN ('DISM') DO (IF "%%a"=="Examples" SET "LANG_PASS=1") IF NOT DEFINED LANG_PASS ECHO.WARNING: Non-english host language/locale. Untested, proceed with caution.&&PAUSE IF NOT "%PROG_FOLDER%"=="X:\$" SET "PROG_MODE=PORTABLE"&&CALL:SETS_HANDLER&&GOTO:MAIN_MENU -IF "%PROG_FOLDER%"=="X:\$" IF NOT "%SystemDrive%"=="X:" ECHO.ERROR: Relocate to path other than X:\$.&&GOTO:CLEAN_EXIT +IF "%PROG_FOLDER%"=="X:\$" IF NOT "%SystemDrive%"=="X:" ECHO.ERROR: Relocate to path other than X:\$.&&GOTO:QUIT IF "%PROG_FOLDER%"=="X:\$" IF "%SystemDrive%"=="X:" SET "PROG_MODE=RAMDISK"&&COLOR 0B IF EXIST "%PROG_FOLDER%\RECOVERY_LOCK" CALL:RECOVERY_LOCK -IF DEFINED LOCKOUT GOTO:CLEAN_EXIT +IF DEFINED LOCKOUT GOTO:QUIT CALL:HOST_AUTO&&CALL:SETS_HANDLER REG.EXE DELETE "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\MiniNT" /f>NUL 2>&1 IF "%AUTOBOOT%"=="ENABLED" SET "BOOT_TARGET=VHDX"&&CALL:BOOT_TOGGLE&&CALL:AUTOBOOT_COUNT -IF "%AUTOBOOT%"=="ENABLED" (GOTO:CLEAN_EXIT) ELSE (CALL:LOGO) +IF "%AUTOBOOT%"=="ENABLED" (GOTO:QUIT) ELSE (CALL:LOGO) ::######################################################################### :MAIN_MENU ::######################################################################### @@ -34,15 +34,15 @@ IF "%AUTOBOOT%"=="ENABLED" (GOTO:CLEAN_EXIT) ELSE (CALL:LOGO) IF "%MENU_MODE%"=="CUSTOM" GOTO:CUSTOM_MODE IF "%MENU_MODE%"=="BASIC" IF "%PROG_MODE%"=="RAMDISK" GOTO:BASIC_MODE IF "%MENU_MODE%"=="BASIC" IF "%PROG_MODE%"=="PORTABLE" GOTO:BASIC_CREATOR -CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&CALL:FREE_CALC&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Windows Deployment Image Customization Kit&&ECHO.&&ECHO. (%##%1%#$%) Image Processing&&ECHO. (%##%2%#$%) Image Management&&ECHO. (%##%3%#$%) Package Creator&&ECHO. (%##%4%#$%) File Management&&ECHO. (%##%5%#$%) Disk Management&&ECHO. (%##%6%#$%) Tasks&&ECHO. (%##%7%#$%) Settings&&IF "%PROG_MODE%"=="RAMDISK" ECHO. (%##%.%#$%) Change Boot Order -ECHO.&&CALL:BOXB1&&CALL:PAD_LINE -IF "%PROG_MODE%"=="RAMDISK" IF "%PROG_SOURCE%"=="Z:\$" ECHO. Disk %#@%%HOST_NUMBER%%#$% UID %#@%%HOST_TARGET%%#$%&&CALL:PAD_LINE +CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:FREE_CALC&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Windows Deployment Image Customization Kit&&ECHO.&&ECHO. (%##%1%#$%) Image Processing&&ECHO. (%##%2%#$%) Image Management&&ECHO. (%##%3%#$%) Package Creator&&ECHO. (%##%4%#$%) File Management&&ECHO. (%##%5%#$%) Disk Management&&ECHO. (%##%6%#$%) Tasks&&ECHO. (%##%7%#$%) Settings&&IF "%PROG_MODE%"=="RAMDISK" ECHO. (%##%.%#$%) Change Boot Order +ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&TITLE Windows Deployment Image Customization Kit v%VER_CUR% (%PROG_SOURCE%) +IF "%PROG_MODE%"=="RAMDISK" IF "%PROG_SOURCE%"=="Z:\%HOST_FOLDERX%" ECHO. Disk %#@%%HOST_NUMBER%%#$% UID %#@%%HOST_TARGET%%#$%&&CALL:PAD_LINE IF "%PROG_MODE%"=="RAMDISK" IF "%PROG_SOURCE%"=="X:\$" ECHO. %XLR2%Disk Error%#$% UID %#@%%HOST_TARGET%%#$%&&CALL:PAD_LINE -IF "%PROG_MODE%"=="RAMDISK" ECHO. (%##%Q%#$%)uit (%##%*%#$%) Basic Menu (%##%U%#$%)pdate %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE -IF "%PROG_MODE%"=="PORTABLE" ECHO. (%##%Q%#$%)uit (%##%*%#$%) Basic Menu %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE +ECHO. (%##%Q%#$%)uit (%##%*%#$%) Basic Menu %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE IF "%SHORTCUTS%"=="ENABLED" ECHO. (%##%%HOTKEY_1%%#$%) (%##%%HOTKEY_2%%#$%) (%##%%HOTKEY_3%%#$%) (%##%%HOTKEY_4%%#$%) (%##%%HOTKEY_5%%#$%)&&CALL:PAD_LINE CALL:MENU_SELECT IF "%SELECT%"=="Q" GOTO:QUIT +IF "%SELECT%"=="CMD" START CMD.EXE IF "%SELECT%"=="OK" CALL:%SELECT% IF DEFINED HOST_ERROR GOTO:MAIN_MENU IF "%SELECT%"=="1" GOTO:IMAGE_PROCESSING @@ -57,10 +57,23 @@ IF "%SELECT%"=="?" CALL:MAIN_MENU_HELP IF "%SELECT%"=="~" SET&&CALL:PAUSED IF "%SELECT%"=="*" IF "%PROG_MODE%"=="PORTABLE" SET "MENU_MODE=BASIC"&&GOTO:BASIC_CREATOR IF "%SELECT%"=="*" IF "%PROG_MODE%"=="RAMDISK" SET "MENU_MODE=BASIC"&&GOTO:BASIC_MODE -IF "%SELECT%"=="U" IF "%PROG_MODE%"=="RAMDISK" GOTO:UPDATE_RECOVERY IF "%SELECT%"=="." IF "%PROG_MODE%"=="RAMDISK" CALL:BCD_MENU IF "%SHORTCUTS%"=="ENABLED" CALL:SHORTCUT_RUN GOTO:MAIN_MENU +:BASIC_MODE +@ECHO OFF&&SET "MOUNT="&&CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:FREE_CALC&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Windows Deployment Image Customization Kit&&ECHO.&&ECHO. (%##%1%#$%) Backup&&ECHO. (%##%2%#$%) Restore&&ECHO. (%##%3%#$%) Boot Creator&&ECHO. (%##%.%#$%) Change Boot Order&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&TITLE Windows Deployment Image Customization Kit v%VER_CUR% (%PROG_SOURCE%) +IF DEFINED HOST_ERROR ECHO. %XLR2%Disk Error%#$% UID %#@%%HOST_TARGET%%#$%&&CALL:PAD_LINE +ECHO. (%##%Q%#$%)uit (%##%*%#$%) Main Menu %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE +CALL:MENU_SELECT +IF "%SELECT%"=="Q" GOTO:QUIT +IF "%SELECT%"=="CMD" START CMD.EXE +IF DEFINED HOST_ERROR GOTO:BASIC_MODE +IF "%SELECT%"=="." CALL:BCD_MENU&SET "SELECT=" +IF "%SELECT%"=="1" CALL:BASIC_BACKUP&SET "SELECT=" +IF "%SELECT%"=="2" CALL:BASIC_RESTORE&SET "SELECT=" +IF "%SELECT%"=="3" GOTO:BASIC_CREATOR&SET "SELECT=" +IF "%SELECT%"=="*" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU +GOTO:BASIC_MODE :PAD_LINE IF NOT DEFINED PAD_TYPE SET "PAD_TYPE=1" IF NOT DEFINED ACC_COLOR SET "ACC_COLOR=6" @@ -119,497 +132,6 @@ IF "%BOX%"=="T2" ECHO.%##%┌───────────────── IF "%BOX%"=="B2" ECHO.%##%└────────────────────────────────────────────────────────────────────┘%#$% SET "BOX="&&CHCP %CHCP_OLD% >NUL EXIT /B -::######################################################################### -:UPDATE_RECOVERY -::######################################################################### -CLS&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Recovery Update&&ECHO.&&ECHO. (%##%1%#$%) Program (%##%*%#$%) Test&&ECHO. (%##%2%#$%) Recovery Password&&ECHO. (%##%3%#$%) Recovery Wallpaper&&ECHO. (%##%4%#$%) Boot Media&&ECHO. (%##%5%#$%) EFI Files&&ECHO.&&ECHO. %XLR4%Note: files located in either the main folder $ or $\Boot are used%#$%&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT -IF NOT DEFINED SELECT GOTO:MAIN_MENU -IF DEFINED HOST_ERROR GOTO:MAIN_MENU -IF "%SELECT%"=="*" IF EXIST "%PROG_SOURCE%\windick.cmd" SET "VER_GET=%PROG_SOURCE%\windick.cmd"&&CALL:VER_GET&© /Y "%PROG_SOURCE%\windick.cmd" "%PROG_FOLDER%"&&GOTO:MAIN_MENU -FOR %%a in (0 1 2 3 ERROR) DO (IF "%FREE%"=="%%a" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Not enough free space. Clear some space and try again.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAUSED&GOTO:MAIN_MENU) -IF "%SELECT%"=="1" GOTO:UPDATE_PROG -IF "%SELECT%"=="2" GOTO:UPDATE_PASS -IF "%SELECT%"=="3" GOTO:UPDATE_BACKGROUND -IF "%SELECT%"=="4" GOTO:UPDATE_BOOT -IF "%SELECT%"=="5" GOTO:UPDATE_EFI -GOTO:UPDATE_RECOVERY -:UPDATE_BACKGROUND -CALL:PE_WALLPAPER -IF NOT DEFINED $PICK GOTO:UPDATE_END -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. This will replace the recovery background.&&ECHO.&&CALL:BOXB1&&CALL:CONFIRM -IF NOT "%CONFIRM%"=="X" GOTO:UPDATE_END -SET "REBOOT_MAN=1"&&CLS&&CALL:BOXT2&&ECHO. %XLR4%Recovery update has been initiated.%#$%&&ECHO. %XLR2%Caution:%#$% Interrupting this process can render the disk unbootable.&&ECHO. -CALL:EFI_MOUNT -IF DEFINED ERROR GOTO:UPDATE_END -CALL:VTEMP_CREATE -IF DEFINED ERROR CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -ECHO. Extracting boot-media...&© /Y "%EFI_LETTER%:\$.WIM" "%BOOT_FOLDER%\$TMP.WIM">NUL 2>&1 -SET "IMAGEFILE=%BOOT_FOLDER%\$TMP.WIM"&&CALL:APPLY_IMAGE -IF NOT EXIST "%APPLYDIR%\Windows" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% BOOT MEDIA&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -ECHO. Using %PE_WALLPAPER% located in folder for the recovery wallpaper. -IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" TAKEOWN /F "%APPLYDIR%\Windows\System32\setup.bmp">NUL 2>&1 -IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" ICACLS "%APPLYDIR%\Windows\System32\setup.bmp" /grant %USERNAME%:F>NUL 2>&1 -IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" COPY /Y "%CACHE_FOLDER%\%PE_WALLPAPER%" "%APPLYDIR%\Windows\System32\setup.bmp">NUL 2>&1 -ECHO. Saving boot-media...&&DEL /Q /F "%EFI_LETTER%:\$.WIM">NUL 2>&1 -SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:CAPTURE_IMAGE -ECHO. Unmounting EFI...&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT -GOTO:UPDATE_END -:UPDATE_PROG -IF NOT EXIST "%PROG_SOURCE%\windick.cmd" SET "ERROR=1"&&ECHO. %XLR4%ERROR:%#$% File windick.cmd is not located in folder. Abort.&&CALL:PAUSED&GOTO:UPDATE_END -SET "VER_GET=%PROG_SOURCE%\windick.cmd"&&SET "VER_SET=VER_X"&&CALL:VER_GET -SET "VER_GET=%PROG_FOLDER%\windick.cmd"&&SET "VER_SET=VER_Y"&&CALL:VER_GET -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. This will replace %#@%v%VER_Y%%#$% with %#@%v%VER_X%%#$%&&ECHO.&&CALL:BOXB1&&CALL:CONFIRM -IF NOT "%CONFIRM%"=="X" GOTO:UPDATE_END -SET "REBOOT_MAN=1"&&CLS&&CALL:BOXT2&&ECHO. %XLR4%Recovery update has been initiated.%#$%&&ECHO. %XLR2%Caution:%#$% Interrupting this process can render the disk unbootable.&&ECHO. -CALL:EFI_MOUNT -IF DEFINED ERROR GOTO:UPDATE_END -CALL:VTEMP_CREATE -IF DEFINED ERROR CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -ECHO. Extracting boot-media...&© /Y "%EFI_LETTER%:\$.WIM" "%BOOT_FOLDER%\$TMP.WIM">NUL 2>&1 -SET "IMAGEFILE=%BOOT_FOLDER%\$TMP.WIM"&&CALL:APPLY_IMAGE -IF NOT EXIST "%APPLYDIR%\Windows" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% BOOT MEDIA&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -ECHO. Using windick.cmd located in folder.&© /Y "%PROG_SOURCE%\windick.cmd" "%APPLYDIR%\$">NUL -ECHO. Saving boot-media...&&DEL /Q /F "%EFI_LETTER%:\$.WIM">NUL 2>&1 -SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:CAPTURE_IMAGE -ECHO. Unmounting EFI...&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT -GOTO:UPDATE_END -:UPDATE_PASS -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. %XLR4%Important:%#$% Do not use any of these symbols [%XLR2% ^< ^> %% ^^! ^& ^^^^ %#$%].&&ECHO.&&ECHO. Enter new recovery password or leave blank to remove.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "PROMPT_SET=RECOVERY_LOCK"&&SET "PROMPT_ANY=1"&&CALL:PROMPT_SET -ECHO.%RECOVERY_LOCK%>"%PROG_SOURCE%\$RCV" -SET /P RECOVERY_LOCK=<"%PROG_SOURCE%\$RCV" -DEL /Q /F "%PROG_SOURCE%\$RCV">NUL 2>&1 -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&IF NOT DEFINED RECOVERY_LOCK ECHO. This will remove the password lock -IF DEFINED RECOVERY_LOCK ECHO. This will change the password to %#@%%RECOVERY_LOCK%%#$% -ECHO.&&CALL:BOXB1&&CALL:CONFIRM -IF NOT "%CONFIRM%"=="X" SET "RECOVERY_LOCK="&&GOTO:UPDATE_END -SET "REBOOT_MAN=1"&&CLS&&CALL:BOXT2&&ECHO. %XLR4%Recovery update has been initiated.%#$%&&ECHO. %XLR2%Caution:%#$% Interrupting this process can render the disk unbootable.&&ECHO. -CALL:EFI_MOUNT -IF DEFINED ERROR SET "RECOVERY_LOCK="&&GOTO:UPDATE_END -CALL:VTEMP_CREATE -IF DEFINED ERROR SET "RECOVERY_LOCK="&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -ECHO. Extracting boot-media...&© /Y "%EFI_LETTER%:\$.WIM" "%BOOT_FOLDER%\$TMP.WIM">NUL 2>&1 -SET "IMAGEFILE=%BOOT_FOLDER%\$TMP.WIM"&&CALL:APPLY_IMAGE -IF NOT EXIST "%APPLYDIR%\Windows" SET "RECOVERY_LOCK="&&SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% BOOT MEDIA&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -IF DEFINED RECOVERY_LOCK ECHO. Password will be changed to %#@%%RECOVERY_LOCK%%#$%. -IF NOT DEFINED RECOVERY_LOCK ECHO. Recovery password will be removed. -IF DEFINED RECOVERY_LOCK ECHO.%RECOVERY_LOCK%>"%APPLYDIR%\$\RECOVERY_LOCK" -IF NOT DEFINED RECOVERY_LOCK DEL /Q /F "\\?\%APPLYDIR%\$\RECOVERY_LOCK">NUL 2>&1 -ECHO. Saving boot-media...&&DEL /Q /F "%EFI_LETTER%:\$.WIM">NUL 2>&1 -SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:CAPTURE_IMAGE -SET "RECOVERY_LOCK="&&ECHO. Unmounting EFI...&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT -GOTO:UPDATE_END -:UPDATE_BOOT -IF NOT EXIST "%BOOT_FOLDER%\boot.sav" CALL:BOOT_FETCH -IF NOT EXIST "%BOOT_FOLDER%\boot.sav" SET "ERROR=1"&&ECHO. %XLR4%ERROR:%#$% File boot.sav is not located in folder. Abort.&&CALL:PAUSED&GOTO:UPDATE_END -MOVE /Y "%BOOT_FOLDER%\boot.sav" "%BOOT_FOLDER%\boot.wim">NUL -FOR /F "TOKENS=1-9 SKIP=4 DELIMS=: " %%a in ('DISM /ENGLISH /GET-IMAGEINFO /IMAGEFILE:%BOOT_FOLDER%\boot.wim /INDEX:1 2^>NUL') DO ( -IF "%%a"=="Version" SET "VER_X=%%b" -IF "%%a %%b"=="ServicePack Build" SET "VER_Z=%%c") -MOVE /Y "%BOOT_FOLDER%\boot.wim" "%BOOT_FOLDER%\boot.sav">NUL -SET "VER_X=%VER_X%.%VER_Z%"&&SET "VER_Y="&&FOR /F "TOKENS=1-9 DELIMS=: " %%a in ('DISM /ENGLISH /ONLINE /GET-CURRENTEDITION 2^>NUL') DO ( -IF "%%a %%b"=="Image Version" SET "VER_Y=%%c") -CALL:PAD_LINE&&CALL:BOXT1&&ECHO. This will replace %#@%v%VER_Y%%#$% with %#@%v%VER_X%%#$%&&SET "VER_X="&&SET "VER_Y="&&SET "VER_Z="&&CALL:BOXB2&&CALL:CONFIRM -IF NOT "%CONFIRM%"=="X" GOTO:UPDATE_END -SET "REBOOT_MAN=1"&&CLS&&CALL:BOXT2&&ECHO. %XLR4%Recovery update has been initiated.%#$%&&ECHO. %XLR2%Caution:%#$% Interrupting this process can render the disk unbootable.&&ECHO. -CALL:EFI_MOUNT -IF DEFINED ERROR GOTO:UPDATE_END -CALL:VTEMP_CREATE -IF DEFINED ERROR CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -ECHO. Extracting boot-media. Using boot.sav located in folder...&© /Y "%BOOT_FOLDER%\boot.sav" "%BOOT_FOLDER%\$TMP.WIM">NUL 2>&1 -SET "INDEX_WORD=Setup"&&SET "IMAGEFILE=%BOOT_FOLDER%\$TMP.WIM"&&CALL:FIND_INDEX -SET "IMAGEFILE=%BOOT_FOLDER%\$TMP.WIM"&&CALL:APPLY_IMAGE -IF NOT EXIST "%APPLYDIR%\Windows" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% BOOT MEDIA&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END -MD "%APPLYDIR%\$">NUL 2>&1 -COPY /Y "%PROG_FOLDER%\DISK_TARGET" "%APPLYDIR%\$">NUL 2>&1 -COPY /Y "%PROG_FOLDER%\windick.cmd" "%APPLYDIR%\$">NUL 2>&1 -IF EXIST "%PROG_FOLDER%\RECOVERY_LOCK" COPY /Y "%PROG_FOLDER%\RECOVERY_LOCK" "%APPLYDIR%\$">NUL 2>&1 -IF NOT EXIST "%PROG_FOLDER%\RECOVERY_LOCK" DEL /Q /F "\\?\%APPLYDIR%\$\RECOVERY_LOCK">NUL 2>&1 -IF EXIST "%APPLYDIR%\setup.exe" DEL /Q /F "\\?\%APPLYDIR%\setup.exe">NUL 2>&1 -IF EXIST "%WINDIR%\System32\setup.bmp" COPY /Y "%WINDIR%\System32\setup.bmp" "%APPLYDIR%\Windows\System32">NUL 2>&1 -(ECHO.[LaunchApp]&&ECHO.AppPath=X:\$\windick.cmd)>"%APPLYDIR%\Windows\System32\winpeshl.ini" -ECHO. Saving boot-media...&&DEL /Q /F "%EFI_LETTER%:\$.WIM">NUL 2>&1 -SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:CAPTURE_IMAGE -ECHO. Unmounting EFI...&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT -GOTO:UPDATE_END -:UPDATE_EFI -IF NOT EXIST "%BOOT_FOLDER%\boot.sdi" IF NOT EXIST "%BOOT_FOLDER%\bootmgfw.efi" SET "ERROR=1"&&ECHO. %XLR4%ERROR:%#$% Files boot.sdi and bootmgfw.efi are not located in folder. Abort.&&CALL:PAUSED&GOTO:UPDATE_END -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. This will replace the current EFI boot files.&&ECHO.&&CALL:BOXB1&&CALL:CONFIRM -IF NOT "%CONFIRM%"=="X" GOTO:UPDATE_END -SET "REBOOT_MAN=1"&&CLS&&CALL:BOXT2&&ECHO. %XLR4%Recovery update has been initiated.%#$%&&ECHO. %XLR2%Caution:%#$% Interrupting this process can render the disk unbootable.&&ECHO. -CALL:EFI_MOUNT -IF DEFINED ERROR GOTO:UPDATE_END -IF EXIST "%BOOT_FOLDER%\boot.sdi" ECHO. Using boot.sdi located in folder, for efi image boot support.&© /Y "%BOOT_FOLDER%\boot.sdi" "%EFI_LETTER%:\Boot">NUL -IF EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. Using bootmgfw.efi located in folder, for the efi bootloader.&© /Y "%BOOT_FOLDER%\bootmgfw.efi" "%EFI_LETTER%:\EFI\Boot\bootx64.efi">NUL -IF NOT EXIST "%BOOT_FOLDER%\boot.sdi" ECHO. File boot.sdi is not located in folder, skipping. -IF NOT EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. File bootmgfw.efi is not located in folder, skipping. -ECHO. Unmounting EFI...&CALL:EFI_UNMOUNT -GOTO:UPDATE_END -:UPDATE_END -IF EXIST "%BOOT_FOLDER%\$TMP.WIM" DEL /Q /F "%BOOT_FOLDER%\$TMP.WIM">NUL 2>&1 -IF DEFINED REBOOT_MAN ECHO.&&ECHO. THE SYSTEM WILL NOW RESTART.&&ECHO.&&ECHO. %#@%UPDATE FINISH:%#$% %DATE% %TIME%&&CALL:BOXB2&&CALL:PAUSED&GOTO:CLEAN_EXIT -GOTO:UPDATE_RECOVERY -:VTEMP_CREATE -IF DEFINED ERROR EXIT /B -CALL:SCRATCH_CREATE -ECHO. Mounting temporary vdisk...&&SET "VDISK=%SCRATCHDIR%\scratch.vhdx"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_CREATE>NUL 2>&1 -IF NOT EXIST "%VDISK_LTR%:\" SET "ERROR=1" -EXIT /B -:VTEMP_DELETE -IF EXIST "%VDISK_LTR%:\" ECHO. Unmounting temporary vdisk...&&SET "VDISK=%SCRATCHDIR%\scratch.vhdx"&&CALL:VDISK_DETACH>NUL 2>&1 -IF EXIST "%PROG_SOURCE%\Scratch" CALL:SCRATCH_DELETE -EXIT /B -::######################################################################### -:BASIC_MODE -::######################################################################### -@ECHO OFF&&SET "MOUNT="&&CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&CALL:FREE_CALC&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Windows Deployment Image Customization Kit&&ECHO.&&ECHO. (%##%1%#$%) Backup&&ECHO. (%##%2%#$%) Restore&&ECHO. (%##%3%#$%) Boot Creator&&ECHO. (%##%.%#$%) Change Boot Order&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE -IF DEFINED HOST_ERROR ECHO. %XLR2%Disk Error%#$% UID %#@%%HOST_TARGET%%#$%&&CALL:PAD_LINE -ECHO. (%##%Q%#$%)uit (%##%*%#$%) Main Menu %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE -CALL:MENU_SELECT -IF "%SELECT%"=="Q" GOTO:QUIT -IF DEFINED HOST_ERROR GOTO:BASIC_MODE -IF "%SELECT%"=="." CALL:BCD_MENU&SET "SELECT=" -IF "%SELECT%"=="1" CALL:BASIC_BACKUP&SET "SELECT=" -IF "%SELECT%"=="2" CALL:BASIC_RESTORE&SET "SELECT=" -IF "%SELECT%"=="3" GOTO:BASIC_CREATOR&SET "SELECT=" -IF "%SELECT%"=="*" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU -GOTO:BASIC_MODE -:BASIC_CREATOR -@ECHO OFF&&SET "MOUNT="&&CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&CALL:FREE_CALC&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Processing / Boot Creator&&ECHO. -SET "SOURCE_LOCATION="&&FOR %%a in (A B C D E F G H I J K L N O P Q R S T U W Y Z) DO (IF EXIST "%%a:\sources\boot.wim" SET "SOURCE_LOCATION=%%a:\sources") -SET "BOOT_EXIST="&&IF EXIST "%BOOT_FOLDER%\BOOT.SAV" SET "BOOT_EXIST=1" -IF "%PROG_MODE%"=="RAMDISK" SET "BOOT_EXIST=1" -SET "WIM_EXIST="&&IF EXIST "%IMAGE_FOLDER%\*.WIM" SET "WIM_EXIST=1" -SET "VHDX_EXIST="&&IF EXIST "%IMAGE_FOLDER%\*.VHDX" SET "VHDX_EXIST=1" -SET "IMAGEPROC_GO="&&FOR %%a in (WIM_EXIST VHDX_EXIST) DO (IF DEFINED %%a SET "IMAGEPROC_GO=1") -SET "BOOTCREATE_GO="&&IF DEFINED BOOT_EXIST IF DEFINED VHDX_EXIST SET "BOOTCREATE_GO=1" -IF DEFINED SOURCE_LOCATION ECHO. (%##%-%#$%) Import Boot %XLR5%Windows Installation Media Detected%#$% Import WIM (%##%+%#$%)&&ECHO. -IF NOT DEFINED IMAGEPROC_GO ECHO. %#@%Insert a Windows Disc/ISO to import installation media%#$%&&ECHO. -IF NOT DEFINED BOOT_EXIST ECHO. %#@%Insert a Windows Disc/ISO to import boot media%#$%&&ECHO. -SET "MENUT0= %#@%AVAILABLE WIMs/VHDXs:%#$%"&&SET "MENUT1= " -IF NOT EXIST "%IMAGE_FOLDER%\*.WIM" IF NOT EXIST "%IMAGE_FOLDER%\*.VHDX" SET "MENUT0="&&SET "MENUT1=" -IF EXIST "%IMAGE_FOLDER%\*.WIM" SET "BLIST=WIM"&&CALL:FILE_LIST -IF EXIST "%IMAGE_FOLDER%\*.VHDX" SET "BLIST=VHDX"&&CALL:FILE_LIST -ECHO.&&CALL:BOXB1&&CALL:PAD_LINE -IF DEFINED IMAGEPROC_GO IF NOT DEFINED BOOTCREATE_GO ECHO. [%#@%IMAGE PROCESSING%#$%] (%##%C%#$%)onvert&&CALL:PAD_LINE -IF DEFINED IMAGEPROC_GO IF DEFINED BOOTCREATE_GO ECHO. [%#@%IMAGE PROCESSING%#$%] (%##%C%#$%)onvert (%##%G%#$%)o^^! [%#@%BOOT CREATOR%#$%]&&CALL:PAD_LINE -IF "%PROG_MODE%"=="PORTABLE" ECHO. (%##%Q%#$%)uit (%##%*%#$%) Main Menu %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE -IF "%PROG_MODE%"=="RAMDISK" CALL:PAD_PREV -CALL:MENU_SELECT -IF NOT DEFINED SELECT IF "%PROG_MODE%"=="RAMDISK" GOTO:BASIC_MODE -IF DEFINED HOST_ERROR IF "%PROG_MODE%"=="RAMDISK" GOTO:BASIC_MODE -IF "%SELECT%"=="Q" GOTO:QUIT -IF "%SELECT%"=="C" CALL:CONVERT_PROMPT&SET "SELECT=" -IF "%SELECT%"=="+" IF DEFINED SOURCE_LOCATION CALL:SOURCE_IMPORT&SET "SELECT=" -IF "%SELECT%"=="-" IF DEFINED SOURCE_LOCATION CALL:BOOT_IMPORT&SET "SELECT=" -IF "%SELECT%"=="*" IF "%PROG_MODE%"=="PORTABLE" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU -IF "%SELECT%"=="G" IF "%PROG_MODE%"=="RAMDISK" IF NOT EXIST "%BOOT_FOLDER%\boot.sav" CALL:BOOT_FETCH -IF "%SELECT%"=="G" IF EXIST "%BOOT_FOLDER%\boot.sav" CALL:BASIC_CREATOR_PROMPT&SET "SELECT=" -GOTO:BASIC_CREATOR -:BASIC_CREATOR_PROMPT -SET "$VHDX=X"&&CALL:VHDX_CHECK -IF DEFINED ERROR EXIT /B -IF DEFINED VHDX_SLOTX IF EXIST "%IMAGE_FOLDER%\%VHDX_SLOTX%" CALL:BOOT_CREATOR_PROMPT -EXIT /B -:CONVERT_PROMPT -SET "MENUT0= Image Processing"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE WIMs/VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%IMAGE_FOLDER%"&&SET "$FILT0=*.WIM *.VHDX"&&CALL:FILE_PICK -IF "%SELECT%"=="." SET "FILE_TYPE=IMAGE"&&CALL:BASIC_FILE&EXIT /B -IF NOT DEFINED $PICK EXIT /B -SET "CONVERT_EXT="&&FOR %%G in ("%$PICK%") DO (SET "CAPS_SET=CONVERT_EXT"&&SET "CAPS_VAR=%%~xG"&&CALL:CAPS_SET) -IF "%CONVERT_EXT%"==".WIM" GOTO:BASIC_RESTORE_X -IF "%CONVERT_EXT%"==".VHDX" GOTO:BASIC_BACKUP_X -EXIT /B -:BASIC_BACKUP -SET "MENUT0= Image Processing"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=VHDX"&&CALL:FILE_PICK -IF "%SELECT%"=="." SET "FILE_TYPE=VHDX"&&CALL:BASIC_FILE&EXIT /B -IF NOT DEFINED $PICK EXIT /B -:BASIC_BACKUP_X -SET "VHDX_SOURCE=%$PICK_BODY%%$PICK_EXT%" -SET "SOURCE_TYPE=VHDX"&&SET "TARGET_TYPE=WIM"&&CALL:IMAGEPROC_TARGET -IF NOT DEFINED WIM_TARGET EXIT /B -IF EXIST "%IMAGE_FOLDER%\%WIM_TARGET%" ECHO.&&ECHO. %XLR4%ERROR:%#$% File already exists.&&EXIT /B -SET "WIM_INDEX=1"&&CALL:IMAGEPROC_START -EXIT /B -:BASIC_RESTORE -SET "MENUT0= Image Processing"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE WIMs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=WIM"&&CALL:FILE_PICK -IF "%SELECT%"=="." SET "FILE_TYPE=WIM"&&CALL:BASIC_FILE&EXIT /B -IF NOT DEFINED $PICK EXIT /B -:BASIC_RESTORE_X -SET "WIM_SOURCE=%$PICK_BODY%%$PICK_EXT%" -CALL:WIM_INDEX_MENU -IF DEFINED ERROR EXIT /B -SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX"&&CALL:IMAGEPROC_TARGET -IF NOT DEFINED VHDX_TARGET EXIT /B -IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" ECHO.&&ECHO. %XLR4%ERROR:%#$% File already exists.&&EXIT /B -CALL:IMAGEPROC_VSIZE -IF DEFINED ERROR EXIT /B -CALL:IMAGEPROC_START -EXIT /B -:BASIC_FILE -IF DEFINED FILE_OPER GOTO:BASIC_FILETYPE -CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. File Operation&&ECHO.&&ECHO. (%##%1%#$%) Rename&&ECHO. (%##%2%#$%) Delete&&ECHO. (%##%3%#$%) Copy&&IF "%FOLDER_MODE%"=="ISOLATED" FOR %%G in (VHDX MAIN IMAGE) DO (IF "%FILE_TYPE%"=="%%G" ECHO. ^(%##%4%#$%^) Move) -ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_SET=FILE_PROMPT"&&CALL:PROMPT_SET -IF "%FILE_PROMPT%"=="1" SET "FILE_OPER=Rename" -IF "%FILE_PROMPT%"=="2" SET "FILE_OPER=Delete" -IF "%FILE_PROMPT%"=="3" SET "FILE_OPER=Copy" -IF "%FILE_PROMPT%"=="4" IF "%FOLDER_MODE%"=="ISOLATED" FOR %%G in (VHDX MAIN IMAGE) DO (IF "%FILE_TYPE%"=="%%G" SET "FILE_OPER=MoveVHDX") -IF NOT DEFINED FILE_OPER GOTO:BASIC_ERROR -:BASIC_FILETYPE -IF "%FILE_OPER%"=="MoveVHDX" IF "%FOLDER_MODE%"=="ISOLATED" CALL:VHDX_MOVE&GOTO:BASIC_ERROR -IF DEFINED FILE_SKIP GOTO:BASIC_FILEOPER -:BASIC_FILEPICK -FOR %%X in (WIM VHDX ISO LIST BASE CAB MSU PKX APPX APPXBUNDLE MSIXBUNDLE) DO (IF "%%X"=="%FILE_TYPE%" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE %%Xs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=%%X"&&CALL:FILE_PICK) -IF "%FILE_TYPE%"=="WALL" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE JPGs/PNGs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%CACHE_FOLDER%"&&SET "$FILT0=*.JPG *.PNG"&&CALL:FILE_PICK -IF "%FILE_TYPE%"=="MAIN" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_PICK -IF "%FILE_TYPE%"=="IMAGE" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE WIMs/VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%IMAGE_FOLDER%"&&SET "$FILT0=*.WIM *.VHDX"&&CALL:FILE_PICK -IF "%FILE_TYPE%"=="LISTS" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE LISTs/BASEs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%LIST_FOLDER%"&&SET "$FILT0=*.LIST *.BASE"&&CALL:FILE_PICK -IF "%FILE_TYPE%"=="PACK" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE PACKAGEs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PACK_FOLDER%"&&SET "$FILT0=*.PKX *.CAB *.MSU *.APPX *.APPXBUNDLE *.MSIXBUNDLE"&&CALL:FILE_PICK -IF "%FILE_TYPE%"=="PKXLIST" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE PKXs/LISTs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PACK_FOLDER%"&&SET "$FILT0=*.PKX"&&SET "$FOLD1=%LIST_FOLDER%"&&SET "$FILT1=*.LIST"&&CALL:FILE_PICK&SET "ERROR=" -IF "%FILE_TYPE%"=="PKXLIST" SET "$PICK_EXT="&&IF DEFINED $TRUMP FOR %%G in ("%$TRUMP%") DO (SET "CAPS_SET=$PICK_EXT"&&SET "CAPS_VAR=%%~xG"&&CALL:CAPS_SET) -IF "%FILE_TYPE%"=="PKXLIST" IF "%$PICK_EXT%"==".PKX" SET "$PICK=%PACK_FOLDER%\%$TRUMP%"&&SET "$PICK_PATH=%PACK_FOLDER%\" -IF "%FILE_TYPE%"=="PKXLIST" IF "%$PICK_EXT%"==".LIST" SET "$PICK=%LIST_FOLDER%\%$TRUMP%"&&SET "$PICK_PATH=%LIST_FOLDER%\" -IF NOT DEFINED $PICK GOTO:BASIC_ERROR -:BASIC_FILEOPER -IF "%FILE_OPER%"=="Delete" CALL:CONFIRM -IF "%FILE_OPER%"=="Delete" IF "%CONFIRM%"=="X" DEL /Q /F "%$PICK%">NUL -IF "%FILE_OPER%"=="Delete" GOTO:BASIC_ERROR -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter new name of %$PICK_EXT%&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_SET=FILE_PROMPT"&&SET "PROMPT_ANY=1"&&CALL:PROMPT_SET -IF NOT DEFINED FILE_PROMPT GOTO:BASIC_ERROR -IF EXIST "%$PICK_PATH%\%FILE_PROMPT%%$PICK_EXT%" GOTO:BASIC_ERROR -SET "CASE=LOWER"&&SET "CAPS_SET=$PICK_EXT"&&SET "CAPS_VAR=%$PICK_EXT%"&&CALL:CAPS_SET -IF "%FILE_OPER%"=="Rename" REN "%$PICK%" "%FILE_PROMPT%%$PICK_EXT%">NUL 2>&1 -IF "%FILE_OPER%"=="Copy" ECHO.Copying %FILE_PROMPT%%$PICK_EXT%...&© /Y "%$PICK%" "%$PICK_PATH%%FILE_PROMPT%%$PICK_EXT%">NUL 2>&1 -:BASIC_ERROR -SET "FILE_OPER="&&SET "FILE_TYPE="&&SET "FILE_NAME="&&SET "FILE_SKIP="&&SET "$PICK=" -EXIT /B -:WIM_INDEX_MENU -CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Processing&&ECHO.&&ECHO. %#@%AVAILABLE INDEXs:%#$%&&ECHO.&&SET "INDEX_TMP="&&SET "NAME_TMP="&&FOR /F "TOKENS=1-9 DELIMS=: " %%a in ('DISM /ENGLISH /Get-ImageInfo /ImageFile:"%IMAGE_FOLDER%\%WIM_SOURCE%"') DO ( -IF "%%a"=="Index" CALL SET "INDEX_TMP=%%b" -IF "%%a"=="Name" CALL SET "NAME_TMP=%%b %%c %%d %%e %%f %%g %%h %%i"&&CALL:WIM_INDEX_LIST) -IF NOT DEFINED INDEX_TMP ECHO.%XLR2%ERROR%#$%&&SET "ERROR=1"&&EXIT /B -SET "INDEX_TMP="&&SET "NAME_TMP="&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT -IF NOT DEFINED SELECT SET "ERROR=1"&&EXIT /B -SET "WIM_INDEX=%SELECT%"&&CALL:WIM_INDEX_QUERY -IF "%WIM_DESC%"=="NULL" ECHO.&&ECHO. %XLR2%ERROR%#$%&&SET "ERROR=1" -EXIT /B -:WIM_INDEX_LIST -ECHO. ( %##%%INDEX_TMP%%#$% ) %NAME_TMP% -EXIT /B -:WIM_INDEX_QUERY -SET "WIM_DESC="&&FOR /F "TOKENS=1-5 DELIMS=<> " %%a in ('DISM /ENGLISH /Get-ImageInfo /ImageFile:"%IMAGE_FOLDER%\%WIM_SOURCE%" /Index:%WIM_INDEX% 2^>NUL') DO (IF "%%a"=="Edition" SET "WIM_DESC=%%c") -IF NOT DEFINED WIM_DESC SET "WIM_INDEX=1"&&SET "WIM_DESC=NULL" -EXIT /B -:BCD_MENU -CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&IF NOT DEFINED BOOT_TIMEOUT SET "BOOT_TIMEOUT=5" -ECHO. Boot Menu Editor&&ECHO.&&ECHO. Time (%##%T%#$%^) %#@%%BOOT_TIMEOUT%%#$% seconds -FOR %%G in (0 1 2 3 4 5 6 7 8 9) DO (CALL ECHO. Slot ^(%##%%%G%#$%^) %#@%%%VHDX_SLOT%%G%%%#$%) -ECHO.&&ECHO. Press (%##%X%#$%) to apply boot menu settings&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT -IF NOT DEFINED SELECT EXIT /B -IF "%SELECT%"=="T" CALL:BOOT_TIMEOUT&SET "SELECT=" -IF "%SELECT%"=="X" IF "%PROG_MODE%"=="RAMDISK" CALL:BCD_REBUILD&SET "SELECT=" -FOR %%G in (0 1 2 3 4 5 6 7 8 9) DO (IF "%SELECT%"=="%%G" SET "$VHDX=%%G"&&CALL:VHDX_CHECK&SET "SELECT=") -GOTO:BCD_MENU -:BOOT_TIMEOUT -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter boot menu timeout in seconds&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT -SET "CHECK=NUM"&&SET "CHECK_VAR=%SELECT%"&&CALL:CHECK -IF NOT DEFINED ERROR SET "BOOT_TIMEOUT=%SELECT%" -IF DEFINED ERROR SET "BOOT_TIMEOUT=" -EXIT /B -:VHDX_MOVE -IF NOT "%FOLDER_MODE%"=="ISOLATED" EXIT /B -CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Move VHDX between folders&&ECHO.&&SET "MENUT0= %#@%IMAGE FOLDER VHDXs:%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "BLIST=VHDX"&&CALL:FILE_LIST -ECHO. ( %##%-%#$% / %##%+%#$% )&&ECHO.&&SET "MENUT0= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "BLIST=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_LIST&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT -IF NOT DEFINED SELECT EXIT /B -IF "%SELECT%"=="-" CALL:MOVE2IMAGE -IF "%SELECT%"=="+" CALL:MOVE2MAIN -GOTO:VHDX_MOVE -:MOVE2IMAGE -SET "MENUT0= Move to image folder"&&SET "MENUT1= "&&SET "MENUT2= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_PICK -IF DEFINED $PICK IF EXIST "%IMAGE_FOLDER%\%$TRUMP%" CALL:PAD_LINE&&ECHO. File already exists in IMAGE folder. Press (%##%X%#$%) to overwrite %#@%%$TRUMP%%#$%.&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET -IF DEFINED $PICK IF EXIST "%IMAGE_FOLDER%\%$TRUMP%" IF NOT "%CONFIRM%"=="X" EXIT /B -IF DEFINED $PICK MOVE /Y "%$PICK%" "%IMAGE_FOLDER%\">NUL -EXIT /B -:MOVE2MAIN -SET "MENUT0= Move to main folder"&&SET "MENUT1= "&&SET "MENUT2= %#@%IMAGE FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=VHDX"&&CALL:FILE_PICK -IF DEFINED $PICK IF EXIST "%PROG_SOURCE%\%$TRUMP%" CALL:PAD_LINE&&ECHO. File already exists in MAIN folder. Press (%##%X%#$%) to overwrite %#@%%$TRUMP%%#$%.&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET -IF DEFINED $PICK IF EXIST "%PROG_SOURCE%\%$TRUMP%" IF NOT "%CONFIRM%"=="X" EXIT /B -IF DEFINED $PICK MOVE /Y "%$PICK%" "%PROG_SOURCE%\">NUL -EXIT /B -:CUSTOM_MODE -@ECHO OFF&&IF NOT EXIST "%LIST_FOLDER%\menu.list" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU -SET "HEAD_EXT=LIST"&&SET "HEAD_CHECK=%LIST_FOLDER%\menu.list"&&CALL:HEAD_CHECK -IF NOT "%$HEAD%"=="MULTI-LIST" ECHO.&&CALL:BOXT1&&ECHO.&&ECHO. %XLR4%ERROR:%#$% menu.list is not a multi list. Leaving custom menu.&&ECHO.&&CALL:BOXB1&&CALL:PAUSED&SET "MENU_MODE=NORMAL"&GOTO:MAIN_MENU -IF NOT DEFINED MENU_BANNER SET "MENU_BANNER= Press ( * ) to return to the main menu" -SET "MOUNT="&&CLS&&CALL:SETS_HANDLER&&SET "TITLE_X= "&&CALL:TITLE_X&&CALL:CLEAN&&CALL:FREE_CALC&&SET "LIST_ACTN="&&SET "LIST_TIME="&&SET "LIST_ITEM=GROUP"&&CALL:PAD_LINE&&CALL:BOXT1&&SET "MENUT0=%#$%%MENU_BANNER%%#$%"&&SET "MENUT1= "&&SET "MENUB8= ( %##%Q%#$% ) Quit"&&SET "MENUB9= "&&SET "$LIST=%LIST_FOLDER%\menu.list"&&SET "ONLY1=GROUP"&&SET "NLIST=LIST"&&CALL:LIST_FILE&&CALL:BOXB1 -CALL:PAD_LINE&&CALL:MENU_SELECT -IF "%SELECT%"=="Q" GOTO:QUIT -IF "%SELECT%"=="*" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU -CALL SET "ITEM_SELECT=%%$ITEM%SELECT%%%" -IF NOT DEFINED ITEM_SELECT GOTO:CUSTOM_MODE -FOR /F "TOKENS=1-9 DELIMS=[]" %%1 IN ("%ITEM_SELECT%") DO (SET "GROUP_TARGET=%%2") -IF NOT DEFINED GROUP_TARGET GOTO:CUSTOM_MODE -CLS&&SET "LIST_ACTN="&&SET "LIST_TIME="&&SET "LIST_ITEM=GROUP"&&CALL:PAD_LINE&&CALL:BOXT1&&SET "MENUT0=%#$%%MENU_BANNER%%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "$LIST=%LIST_FOLDER%\menu.list"&&SET "ONLY1=GROUP"&&SET "ONLY2=%GROUP_TARGET%"&&SET "NLIST=LIST"&&CALL:LIST_FILE&&CALL:BOXB1&&CALL:PAD_LINE -IF DEFINED ERROR GOTO:MAIN_MENU -CALL:PAD_PREV&&CALL:MENU_SELECT -CALL SET "ITEM_SELECT=%%$ITEM%SELECT%%%" -IF NOT DEFINED ITEM_SELECT GOTO:CUSTOM_MODE -COPY /Y "%LIST_FOLDER%\menu.list" "$HZ">NUL&&SET "MLT_SESSION=1"&&ECHO.EXEC-LIST>"$LST2" -CALL SET "FULL_TARGET=%ITEM_SELECT%"&&CALL:GROUP_POPULATE -SET "$RUN=%PROG_FOLDER%\$LST2"&&SET "CURR_SESSION=MULTI"&&SET "LST_SESSION=1"&&SET "LIVE_APPLY=1"&&CALL:LIST_RUN -SET "CURR_SESSION="&&SET "MLT_SESSION="&&SET "LST_SESSION="&&SET "PKX_SESSION="&&GOTO:CUSTOM_MODE -::######################################################################### -:COMMAND_MODE -::######################################################################### -IF DEFINED ARG1 IF NOT "%ARG1%"=="/?" IF NOT "%ARG1%"=="-HELP" IF NOT "%ARG1%"=="-AUTOBOOT" IF NOT "%ARG1%"=="-NEXTBOOT" IF NOT "%ARG1%"=="-BOOTMAKER" IF NOT "%ARG1%"=="-DISKMGR" IF NOT "%ARG1%"=="-FILEMGR" IF NOT "%ARG1%"=="-IMAGEPROC" IF NOT "%ARG1%"=="-IMAGEMGR" ECHO.Type windick.cmd -help for more options.&&GOTO:CLEAN_EXIT -SET "MOUNT="&&SET "ERROR="&&SET "PROG_SOURCE=%PROG_FOLDER%"&&CALL:SETS_MAIN&&SET "PAD_TYPE=0" -IF "%ARG1%"=="/?" SET "ARG1=-HELP" -IF "%ARG1%"=="-HELP" CALL:COMMAND_HELP -IF "%ARG1%"=="-FILEMGR" IF NOT "%ARG2%"=="-GRANT" ECHO.Valid options are -grant -IF "%ARG1%"=="-FILEMGR" IF "%ARG2%"=="-GRANT" IF NOT EXIST "%ARG3%" ECHO.%ARG3% doesn't exist -IF "%ARG1%"=="-FILEMGR" IF "%ARG2%"=="-GRANT" IF DEFINED ARG3 IF EXIST "%ARG3%" SET "$PICK=%ARG3%"&&SET "NO_PAUSE=1"&&CALL:FMGR_OWN -IF "%ARG1%"=="-NEXTBOOT" IF NOT "%ARG2%"=="-RECOVERY" IF NOT "%ARG2%"=="-VHDX" ECHO.Valid options are -recovery and -vhdx -IF "%ARG1%"=="-NEXTBOOT" FOR %%a in (VHDX RECOVERY) DO (IF "%ARG2%"=="-%%a" SET "BOOT_TARGET=%%a"&&CALL:BOOT_TOGGLE) -IF "%ARG1%"=="-NEXTBOOT" IF DEFINED NEXT_BOOT CALL ECHO.Next boot is %NEXT_BOOT% -IF "%ARG1%"=="-NEXTBOOT" IF NOT DEFINED NEXT_BOOT CALL ECHO. %XLR4%ERROR:%#$% The boot environment is not installed on this disk. -IF "%ARG1%"=="-AUTOBOOT" IF NOT "%ARG2%"=="-INSTALL" IF NOT "%ARG2%"=="-REMOVE" ECHO.Valid options are -install and -remove -IF "%ARG1%"=="-AUTOBOOT" IF "%ARG2%"=="-REMOVE" SET "BOOTSVC=REMOVE"&&CALL:AUTOBOOT_SVC&ECHO.AutoBoot switcher is removed -IF "%ARG1%"=="-AUTOBOOT" IF "%ARG2%"=="-INSTALL" SET "BOOTSVC=INSTALL"&&CALL:AUTOBOOT_SVC&ECHO.AutoBoot switcher is installed -IF "%ARG1%"=="-BOOTMAKER" CALL:COMMAND_BOOTMAKER -IF "%ARG1%"=="-DISKMGR" CALL:COMMAND_DISKMGR -IF "%ARG1%"=="-IMAGEMGR" CALL:COMMAND_IMAGEMGR -IF "%ARG1%"=="-IMAGEPROC" CALL:COMMAND_IMAGEPROC -GOTO:CLEAN_EXIT -:COMMAND_IMAGEPROC -IF "%ARG2%"=="-WIM" IF DEFINED ARG3 IF NOT EXIST "%IMAGE_FOLDER%\%ARG3%" ECHO.WIM %IMAGE_FOLDER%\%ARG3% doesn't exist&&EXIT /B -IF "%ARG2%"=="-VHDX" IF DEFINED ARG3 IF NOT EXIST "%IMAGE_FOLDER%\%ARG3%" ECHO.VHDX %IMAGE_FOLDER%\%ARG3% doesn't exist&&EXIT /B -IF "%ARG2%"=="-WIM" IF DEFINED ARG3 IF EXIST "%IMAGE_FOLDER%\%ARG3%" IF "%ARG4%"=="-INDEX" IF DEFINED ARG5 IF "%ARG6%"=="-VHDX" IF DEFINED ARG7 IF "%ARG8%"=="-SIZE" IF DEFINED ARG9 SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX"&&SET "WIM_SOURCE=%ARG3%"&&SET "WIM_INDEX=%ARG5%"&&SET "VHDX_TARGET=%ARG7%"&&SET "VHDX_SIZE=%ARG9%"&&CALL:IMAGEPROC_START -IF "%ARG2%"=="-VHDX" IF DEFINED ARG3 IF EXIST "%IMAGE_FOLDER%\%ARG3%" IF "%ARG4%"=="-INDEX" IF DEFINED ARG5 IF "%ARG6%"=="-WIM" IF DEFINED ARG7 IF "%ARG8%"=="-XLVL" IF DEFINED ARG9 SET "SOURCE_TYPE=VHDX"&&SET "TARGET_TYPE=WIM"&&SET "VHDX_SOURCE=%ARG3%"&&SET "WIM_INDEX=%ARG5%"&&SET "WIM_TARGET=%ARG7%"&&SET "WIM_XLVL=%ARG9%"&&CALL:IMAGEPROC_START -EXIT /B -:COMMAND_IMAGEMGR -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-LIST" IF DEFINED ARG4 IF NOT EXIST "%LIST_FOLDER%\%ARG4%" ECHO.%LIST_FOLDER%\%ARG4% doesn't exist&&EXIT /B -IF "%ARG2%"=="-RUN" IF "%ARG5%"=="-VHDX" IF DEFINED ARG6 IF NOT EXIST "%IMAGE_FOLDER%\%ARG6%" ECHO.%IMAGE_FOLDER%\%ARG6% doesn't exist&&EXIT /B -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" CALL:MOUNT_CLEAR&&IF DEFINED ARG4 SET "PARSE_X="&&FOR /F "TOKENS=1-9* DELIMS=[]" %%a in ('ECHO.%ARG0%') DO (IF "%%b"=="COMMAND" SET "PARSE_X=1"&&SET "ARG4=[%%b][%%c][%%d][%%e]"&&SET "ARGZ=5"&&CALL SET "ARGX=%%f"&&CALL:ARGUE) -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" CALL:MOUNT_REST&&IF DEFINED PARSE_X FOR /F "TOKENS=1-6* DELIMS= " %%a in ('ECHO.%ARG5%') DO (SET "ARG5=%%a"&&SET "ARG6=%%b"&&SET "ARG7=%%c"&&SET "ARG8=%%d"&&SET "ARG9=%%e") -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" IF DEFINED PARSE_X SET "PARSE_X="&&FOR %%a in (5 6 7 8 9) DO (SET "CAPS_SET=ARG%%a"&&CALL SET "CAPS_VAR=%%ARG%%a%%"&&CALL:CAPS_SET) -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" IF DEFINED ARG4 SET "DEL_Z=1"&&SET "ARG3=-LIST"&&SET "ARG4=$LSTZ"&&(ECHO.EXEC-LIST&&ECHO.%ARG4%)>"%LIST_FOLDER%\$LSTZ" -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-LIST" IF DEFINED ARG4 IF EXIST "%LIST_FOLDER%\%ARG4%" SET "$RUN=%LIST_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-LIVE" SET "LIVE_APPLY=1"&&SET "CURR_SESSION=EXEC"&&SET "LST_SESSION=1"&&CALL:LIST_RUN -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-LIST" IF DEFINED ARG4 IF EXIST "%LIST_FOLDER%\%ARG4%" SET "$RUN=%LIST_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-VHDX" SET "LIVE_APPLY="&&IF DEFINED ARG6 IF EXIST "%IMAGE_FOLDER%\%ARG6%" SET "VDISK=%IMAGE_FOLDER%\%ARG6%"&&SET "CURR_SESSION=EXEC"&&SET "LST_SESSION=1"&&SET "VDISK_FLAG=1"&&CALL:LIST_RUN -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-PKX" IF DEFINED ARG4 IF EXIST "%PACK_FOLDER%\%ARG4%" SET "PKX_PACK=%PACK_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-LIVE" SET "LIVE_APPLY=1"&&SET "CURR_SESSION=PACK"&&SET "PKX_SESSION=1"&&CALL:PKX_RUN -IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-PKX" IF DEFINED ARG4 IF EXIST "%PACK_FOLDER%\%ARG4%" SET "PKX_PACK=%PACK_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-VHDX" SET "LIVE_APPLY="&&IF DEFINED ARG6 IF EXIST "%IMAGE_FOLDER%\%ARG6%" SET "VDISK=%IMAGE_FOLDER%\%ARG6%"&&SET "CURR_SESSION=PACK"&&SET "PKX_SESSION=1"&&SET "VDISK_FLAG=1"&&CALL:PKX_RUN -SET "VDISK_FLAG="&&SET "CURR_SESSION="&&SET "LST_SESSION="&&SET "PKX_SESSION="&&IF DEFINED DEL_Z SET "DEL_Z="&&DEL /Q /F "%LIST_FOLDER%\$LSTZ">NUL 2>&1 -EXIT /B -:COMMAND_DISKMGR -IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "DISK_TARGET=%ARG4%"&&CALL:DISK_DETECT>NUL -IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "ARG3=-DISK"&&SET "ARG4=%DISK_DETECT%" -IF DEFINED ARG2 IF "%ARG3%"=="-DISK" IF "%DISK_TARGET%"=="00000000" ECHO.Disk uid 00000000 can not be addressed by uid. Convert to GPT first (erase).&&EXIT /B -IF "%ARG2%"=="-LIST" CALL:DISK_LIST -IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&CALL:DISK_DETECT>NUL 2>&1 -IF "%ARG3%"=="-DISK" IF DEFINED ARG4 CALL SET "DISK_TARGET=%%DISKID_%DISK_NUMBER%%%"&&CALL:DISK_DETECT>NUL -IF "%ARG2%"=="-INSPECT" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&CALL:DISKMGR_INSPECT -IF "%ARG2%"=="-ERASE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&SET "$GET=TST_LETTER"&&CALL:LETTER_ANY&&CALL:DISKMGR_ERASE&SET "TST_LETTER=" -IF "%ARG2%"=="-CHANGEUID" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&SET "GET_DISK_ID=%ARG5%"&&CALL:DISKMGR_CHANGEID -IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-SIZE" IF DEFINED ARG6 SET "PART_SIZE=%ARG6%"&&CALL:DISKMGR_CREATE -IF "%ARG2%"=="-FORMAT" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-PART" IF DEFINED ARG6 SET "PART_NUMBER=%ARG6%"&&CALL:DISKMGR_FORMAT -IF "%ARG2%"=="-DELETE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-PART" IF DEFINED ARG6 SET "PART_NUMBER=%ARG6%"&&CALL:DISKMGR_DELETE -IF "%ARG2%"=="-MOUNT" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-PART" IF DEFINED ARG6 SET "PART_NUMBER=%ARG6%"&&IF "%ARG7%"=="-LETTER" IF DEFINED ARG8 SET "DISK_LETTER=%ARG8%"&&CALL:DISKMGR_MOUNT -IF "%ARG2%"=="-MOUNT" IF "%ARG3%"=="-VHDX" IF EXIST "%IMAGE_FOLDER%\%ARG4%" SET "VDISK=%IMAGE_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-LETTER" IF DEFINED ARG6 SET "VDISK_LTR=%ARG6%"&&CALL:VDISK_ATTACH -IF "%ARG2%"=="-UNMOUNT" IF "%ARG3%"=="-LETTER" IF DEFINED ARG4 SET "$LTR=%ARG4%"&&CALL:DISKMGR_UNMOUNT -EXIT /B -:COMMAND_BOOTMAKER -IF "%ARG2%"=="-CREATE" IF NOT EXIST "%BOOT_FOLDER%\BOOT.SAV" ECHO.BOOT MEDIA %BOOT_FOLDER%\BOOT.SAV doesn't exist&&EXIT /B -IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "DISK_TARGET=%ARG4%"&&CALL:DISK_DETECT>NUL -IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "ARG3=-DISK"&&SET "ARG4=%DISK_DETECT%" -IF DEFINED ARG2 IF "%ARG3%"=="-DISK" IF "%DISK_TARGET%"=="00000000" ECHO.Disk uid 00000000 can not addressed by uid. Convert to GPT first (erase).&&EXIT /B -IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&CALL:DISK_DETECT>NUL 2>&1 -IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 CALL SET "DISK_TARGET=%%DISKID_%DISK_NUMBER%%%"&&CALL:DISK_DETECT>NUL -IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 IF "%ARG7%"=="-SIZE" IF DEFINED ARG8 SET "HOST_SIZE=%ARG8%"&&SET "CHECK=NUM"&&SET "CHECK_VAR=%ARG8%"&&CALL:CHECK -IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 IF "%ARG7%"=="-SIZE" IF DEFINED ARG8 IF DEFINED ERROR ECHO. %XLR4%ERROR:%#$% Invalid host partition size.&&EXIT /B -IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 IF DEFINED ARG6 SET "VHDX_SLOTX=%ARG6%"&&CALL:BOOT_CREATOR_START -EXIT /B -:COMMAND_HELP -ECHO. Command Line Parameters: -ECHO. %##%Miscellaneous%#$% -ECHO. -help This menu -ECHO. -nextboot -vhdx Schedule next boot to vhdx -ECHO. -nextboot -recovery Schedule next boot to recovery -ECHO. -autoboot -install Install reboot to recovery switcher service -ECHO. -autoboot -remove Remove reboot to recovery switcher service -ECHO. %##%Image Processing%#$% -ECHO. -imageproc -wim %#@%x.wim%#$% -index %#@%#%#$% -vhdx %#@%x.vhdx%#$% -size %#@%MB%#$% WIM to VHDX Conversion -ECHO. -imageproc -vhdx %#@%x.vhdx%#$% -index %#@%#%#$% -wim %#@%x.wim%#$% -xlvl %#@%fast/max%#$% VHDX to WIM Conversion -ECHO. Examples- -ECHO. %#@%-imageproc -wim x.wim -index 1 -vhdx x.vhdx -size 25600%#$% -ECHO. %#@%-imageproc -vhdx x.vhdx -index 1 -wim x.wim -xlvl fast%#$% -ECHO. %##%Image Management%#$% -ECHO. -imagemgr -run -list %#@%x.list%#$% -live /or/ -vhdx %#@%x.vhdx%#$% Run list -ECHO. -imagemgr -run -item %#@%"[x][x][x][x]"%#$% -live /or/ -vhdx %#@%x.vhdx%#$% Run item -ECHO. -imagemgr -run -pkx %#@%x.pkx%#$% -live /or/ -vhdx %#@%x.vhdx%#$% Run Package w/integrated list -ECHO. Examples- -ECHO. %#@%-imagemgr -run -list "x y z.list" -live%#$% -ECHO. %#@%-imagemgr -run -pkx x.pkx -vhdx x.vhdx%#$% -ECHO. %#@%-imagemgr -run -item "[EXTPACKAGE][x y z.appx][INSTALL][IA]" -vhdx x.vhdx%#$% -ECHO. %##%File Management%#$% -ECHO. -filemgr -grant %#@%file/folder%#$% Take ownership + Grant Permissions -ECHO. Examples- -ECHO. %#@%-filemgr -grant c:\x.txt%#$% -ECHO. %##%Disk Management%#$% -ECHO. -diskmgr -list Condensed list of disks -ECHO. -diskmgr -inspect -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% DiskPart inquiry on specified disk -ECHO. -diskmgr -erase -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% Delete all partitions on specified disk -ECHO. -diskmgr -create -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -size %#@%MB%#$% Create NTFS partition on specified disk -ECHO. -diskmgr -format -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -part %#@%#%#$% Format partition w/NTFS on specified disk -ECHO. -diskmgr -delete -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -part %#@%#%#$% Delete partition on specified disk -ECHO. -diskmgr -changeuid -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% %#@%new-uid%#$% Change disk uid of specified disk -ECHO. -diskmgr -mount -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -part %#@%#%#$% -letter %#@%letter%#$% Assign drive letter -ECHO. -diskmgr -unmount -letter %#@%letter%#$% Remove drive letter -ECHO. -diskmgr -mount -vhdx %#@%x.vhdx%#$% -letter %#@%letter%#$% Mount virtual disk -ECHO. Examples- -ECHO. %#@%-diskmgr -create -disk 0 -size 25600%#$% -ECHO. %#@%-diskmgr -mount -disk 0 -part 1 -letter e%#$% -ECHO. %#@%-diskmgr -unmount -letter e%#$% -ECHO. %##%Boot Creator%#$% -ECHO. -bootmaker -create -disk %#@%#%#$% -vhdx %#@%x.vhdx%#$% Erase specified disk and make bootable -ECHO. -bootmaker -create -diskuid %#@%uid%#$% -vhdx %#@%x.vhdx%#$% -size %#@%MB%#$% Erase specified disk and make bootable + set host partition size -ECHO. Examples- -ECHO. %#@%-bootmaker -create -disk 0 -vhdx x.vhdx%#$% Default is the entire disk when size is not specified -ECHO. %#@%-bootmaker -create -diskuid 12345678-1234-1234-1234-123456781234 -vhdx x.vhdx -size 100000%#$% -ECHO.&&PAUSE -EXIT /B -:DISCLAIMER -CLS&&CALL:PAD_LINE&&CALL:BOXT1 -ECHO. %XLR2%DISCLAIMER%#$%&&ECHO. -ECHO. It's recommended to backup your data before making any changes -ECHO. to the live operating system or performing disk partitioning. -ECHO. Running this tool on a host-OS language other than english -ECHO. can cause serious malfunctions and is not recommended. -ECHO. -ECHO. The user assumes liability for loss relating to the use of this tool. -ECHO.&&ECHO. Do You Agree? (%##%Y%#$%/%##%N%#$%) -ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "PROMPT_SET=ACCEPTX"&&CALL:PROMPT_SET -IF "%ACCEPTX%"=="Y" SET "DISCLAIMER=ACCEPTED" -IF NOT "%DISCLAIMER%"=="ACCEPTED" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. The ( %##%@%#$% ) %##%Current Environment%#$% option ^& disk management area&&ECHO. are the 'caution zones' and can be avoided if unsure.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAUSED -EXIT /B -:TITLECARD -SET "RND_SET=TITX"&&CALL:RANDOM -IF "%TITX%"=="1" SET "TITLE_X= When finished, backup by converting to WIM." -IF "%TITX%"=="2" SET "TITLE_X= Boot media can be imported in Image Processing using (-)." -IF "%TITX%"=="3" SET "TITLE_X= Modify the boot menu while booted into recovery mode." -IF "%TITX%"=="4" SET "TITLE_X= Export/import all current drivers, combine into a driver-pack." -IF "%TITX%"=="5" SET "TITLE_X= Generate a base-list (Appx/Comp/Feat/Serv/Task) in image management." -IF "%TITX%"=="6" SET "TITLE_X= Try the basic menu for a simple and streamlined recovery experience." -IF "%TITX%"=="7" SET "TITLE_X= Difference base-lists to compare editions or to match the configuration." -IF "%TITX%"=="8" SET "TITLE_X= Update the EFI files, program, or boot media while booted into recovery." -IF "%TITX%"=="9" SET "TITLE_X= SetupComplete/RunOnce items apply to Current Environment (Live), but are simply delayed." -IF "%TITX%"=="0" SET "TITLE_X= Build, administrate and backup your Windows in a native WinPE recovery environment." -IF "%MENU_MODE%"=="BASIC" SET "TITLE_X=" -CALL:TITLE_X -EXIT /B -:TITLE_X -IF NOT DEFINED TITLE_X SET "TITLE_X=Windows Deployment Image Customization Kit v%VER_CUR% (%PROG_SOURCE%)" -TITLE %TITLE_X%&&SET "TITLE_X="&&SET "TITX=" -EXIT /B -:MAIN_MENU_HELP -CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Main Menu Help &&ECHO.&&ECHO. (%##%1%#$%) Image Processing %#@%Convert/isolate WIM/VHDX images%#$%&&ECHO. (%##%2%#$%) Image Management %#@%Perform image related tasks%#$%&&ECHO. (%##%3%#$%) Package Creator %#@%Create driver/scripted/listed packages%#$%&&ECHO. (%##%4%#$%) File Management %#@%Simple file manager, file-picker%#$%&&ECHO. (%##%5%#$%) Disk Management %#@%Basic disk partitioning%#$%&&ECHO. (%##%B%#$%) Boot Creator %#@%Create bootable deployment environment%#$%&&ECHO. (%##%6%#$%) Tasks %#@%Miscellaneous tasks%#$%&&ECHO. (%##%7%#$%) Settings %#@%Settings configuration%#$%&&ECHO. (%##%*%#$%) Basic Menu %#@%Reduced functionality mode%#$%&&ECHO. -(%##%.%#$%) Change Boot Order %#@%Configure VHDX boot order%#$%&&ECHO. -(%##%U%#$%) Update %#@%Push various updates to EFI%#$%&&ECHO.&&ECHO. - Appears only when booted into recovery&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAUSED -EXIT /B :MENU_SELECT SET "$TRUMP="&&SET "SELECT="&&SET /P "SELECT=$>>" IF NOT DEFINED SELECT EXIT /B @@ -661,8 +183,14 @@ EXIT /B :PAUSED SET /P "PAUSED=. Press (%##%Enter%#$%) to continue..." EXIT /B +:VER_GET +IF NOT DEFINED VER_SET SET "VER_SET=VER_CUR" +IF EXIST "%VER_GET%" SET /P VER_CHK=<"%VER_GET%" +FOR /F "TOKENS=1-9 DELIMS= " %%A IN ("%VER_CHK%") DO (SET "%VER_SET%=%%G") +SET "VER_CHK="&&SET "VER_GET="&&SET "VER_SET=" +EXIT /B :RECOVERY_LOCK -SET "LOCKOUT="&&ECHO.Enter password +SET "LOCKOUT="&&ECHO. Enter password SET "PROMPT_SET=RECOVERY_PROMPT"&&SET "PROMPT_ANY=1"&&CALL:PROMPT_SET SET /P RECOVERY_LOCK=<"%PROG_FOLDER%\RECOVERY_LOCK" IF NOT "%RECOVERY_PROMPT%"=="%RECOVERY_LOCK%" SET "LOCKOUT=1" @@ -691,23 +219,16 @@ CALL SET "ARG%ARGZ%=%ARGX:"=%" EXIT /B :CHECK SET "ERROR="&&IF NOT DEFINED CHECK_VAR SET "ERROR=1" -IF NOT DEFINED ERROR IF "%CHECK%"=="NUM" FOR /F "DELIMS=" %%$ in ('CMD.EXE /D /U /C ECHO.%CHECK_VAR%^| FIND /V ""') do ( -SET "PASS="&&FOR %%a in (0 1 2 3 4 5 6 7 8 9) DO (IF "%%a"=="%%$" SET "PASS=1") +IF "%CHECK%"=="CUST" SET "CHECK_FLT=%CHECK_FLT%" +IF "%CHECK%"=="NUM" SET "CHECK_FLT=0 1 2 3 4 5 6 7 8 9" +IF "%CHECK%"=="LTR" SET "CHECK_FLT=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z" +IF "%CHECK%"=="ALPHA" SET "CHECK_FLT=0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z" +IF NOT DEFINED ERROR FOR /F "DELIMS=" %%$ in ('CMD.EXE /D /U /C ECHO.%CHECK_VAR%^| FIND /V ""') do ( +SET "PASS="&&FOR %%a in (%CHECK_FLT%) DO (IF "%%a"=="%%$" SET "PASS=1") IF NOT DEFINED PASS SET "ERROR=1" -IF "%%$"==" " SET "ERROR=1") -IF NOT DEFINED ERROR IF "%CHECK%"=="LTR" SET "CAPS_SET=CHECK_VAR"&&SET "CAPS_VAR=%CHECK_VAR%"&&CALL:CAPS_SET -IF NOT DEFINED ERROR IF "%CHECK%"=="LTR" FOR /F "DELIMS=" %%$ in ('CMD.EXE /D /U /C ECHO.%CHECK_VAR%^| FIND /V ""') do ( -SET "PASS="&&FOR %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (IF "%%a"=="%%$" SET "PASS=1") -IF NOT DEFINED PASS SET "ERROR=1" -IF "%%$"==" " SET "ERROR=1") +IF NOT DEFINED SPACE IF "%%$"==" " SET "ERROR=1") IF DEFINED ERROR ECHO. %XLR4%ERROR:%#$% input [ %XLR4%%CHECK_VAR%%#$% ] is invalid -SET "CHECK="&&SET "CHECK_VAR=" -EXIT /B -:VER_GET -IF NOT DEFINED VER_SET SET "VER_SET=VER_CUR" -IF EXIST "%VER_GET%" SET /P VER_CHK=<"%VER_GET%" -FOR /F "TOKENS=1-9 DELIMS= " %%A IN ("%VER_CHK%") DO (SET "%VER_SET%=%%G") -SET "VER_CHK="&&SET "VER_GET="&&SET "VER_SET=" +SET "CHECK="&&SET "CHECK_VAR="&&SET "CHECK_FLT="&&SET "SPACE=" EXIT /B :LOGO IF "%RECOVERY_LOGO%"=="DISABLED" EXIT /B @@ -766,14 +287,18 @@ FOR %%a in (%SETS_LIST%) DO (CALL ECHO.%%a=%%%%a%%>>"settings.ini") SET "SETS_LIST="&&IF "%PROG_MODE%"=="RAMDISK" IF "%PROG_SOURCE%"=="X:\$" SET "HOST_GET=1" IF "%PROG_MODE%"=="RAMDISK" IF NOT "%DISK_TARGET%"=="%HOST_TARGET%" SET "HOST_GET=1" IF DEFINED HOST_GET SET "HOST_GET="&&CALL:HOST_AUTO -IF "%PROG_MODE%"=="RAMDISK" IF EXIST "Z:\$" COPY /Y "settings.ini" "Z:\$">NUL +IF "%PROG_MODE%"=="RAMDISK" IF EXIST "Z:\%HOST_FOLDERX%" COPY /Y "settings.ini" "Z:\%HOST_FOLDERX%">NUL :SETS_MAIN IF NOT DEFINED + SET "@=^^"&&SET "+=^&"&&SET "{=^<"&&SET "}=^>"&&SET "}}=^>^>"&&SET "-=^|" IF NOT DEFINED PROJ_SLOT SET "PROJ_SLOT=1" SET "MAKER_FOLDER=%PROG_SOURCE%\Project%PROJ_SLOT%" +IF NOT DEFINED WIM_XLVL SET "WIM_XLVL=FAST" +IF NOT DEFINED VHDX_SIZE SET "VHDX_SIZE=25600" IF NOT DEFINED PAD_BOX SET "PAD_BOX=ENABLED" IF NOT DEFINED PAD_SEQ SET "PAD_SEQ=6666600000" IF NOT DEFINED SHORTCUTS SET "SHORTCUTS=DISABLED" +IF NOT DEFINED HOST_FOLDER SET "HOST_FOLDER=$" +IF NOT DEFINED HOST_HIDE SET "HOST_HIDE=DISABLED" IF NOT DEFINED ADDFILE_0 SET "ADDFILE_0=LIST\tweaks.base" IF NOT DEFINED ADDFILE_1 SET "ADDFILE_1=LIST\tools.list" IF NOT DEFINED HOTKEY_1 SET "HOTKEY_1=CMD"&&SET "SHORT_1=CMD.EXE" @@ -933,26 +458,150 @@ IF "%HEAD_EXT%"=="BASE" IF NOT "%$HEAD%"=="BASE-LIST" IF NOT "%$HEAD%"=="BASE-GR SET "HEAD_CHECK="&&SET "HEAD_EXT="&&IF DEFINED ERROR ECHO.&&ECHO. %XLR2%ERROR:%#$% Bad file header, check file.&&ECHO. EXIT /B ::######################################################################### +:COMMAND_MODE +::######################################################################### +IF DEFINED ARG1 IF NOT "%ARG1%"=="/?" IF NOT "%ARG1%"=="-HELP" IF NOT "%ARG1%"=="-AUTOBOOT" IF NOT "%ARG1%"=="-NEXTBOOT" IF NOT "%ARG1%"=="-BOOTMAKER" IF NOT "%ARG1%"=="-DISKMGR" IF NOT "%ARG1%"=="-FILEMGR" IF NOT "%ARG1%"=="-IMAGEPROC" IF NOT "%ARG1%"=="-IMAGEMGR" ECHO.Type windick.cmd -help for more options.&&GOTO:QUIT +SET "MOUNT="&&SET "ERROR="&&SET "PROG_SOURCE=%PROG_FOLDER%"&&CALL:SETS_MAIN&&SET "PAD_TYPE=0" +IF "%ARG1%"=="/?" SET "ARG1=-HELP" +IF "%ARG1%"=="-HELP" CALL:COMMAND_HELP +IF "%ARG1%"=="-FILEMGR" IF NOT "%ARG2%"=="-GRANT" ECHO.Valid options are -grant +IF "%ARG1%"=="-FILEMGR" IF "%ARG2%"=="-GRANT" IF NOT EXIST "%ARG3%" ECHO.%ARG3% doesn't exist +IF "%ARG1%"=="-FILEMGR" IF "%ARG2%"=="-GRANT" IF DEFINED ARG3 IF EXIST "%ARG3%" SET "$PICK=%ARG3%"&&SET "NO_PAUSE=1"&&CALL:FMGR_OWN +IF "%ARG1%"=="-NEXTBOOT" IF NOT "%ARG2%"=="-RECOVERY" IF NOT "%ARG2%"=="-VHDX" ECHO.Valid options are -recovery and -vhdx +IF "%ARG1%"=="-NEXTBOOT" FOR %%a in (VHDX RECOVERY) DO (IF "%ARG2%"=="-%%a" SET "BOOT_TARGET=%%a"&&CALL:BOOT_TOGGLE) +IF "%ARG1%"=="-NEXTBOOT" IF DEFINED NEXT_BOOT CALL ECHO.Next boot is %NEXT_BOOT% +IF "%ARG1%"=="-NEXTBOOT" IF NOT DEFINED NEXT_BOOT CALL ECHO. %XLR4%ERROR:%#$% The boot environment is not installed on this disk. +IF "%ARG1%"=="-AUTOBOOT" IF NOT "%ARG2%"=="-INSTALL" IF NOT "%ARG2%"=="-REMOVE" ECHO.Valid options are -install and -remove +IF "%ARG1%"=="-AUTOBOOT" IF "%ARG2%"=="-REMOVE" SET "BOOTSVC=REMOVE"&&CALL:AUTOBOOT_SVC&ECHO.AutoBoot switcher is removed +IF "%ARG1%"=="-AUTOBOOT" IF "%ARG2%"=="-INSTALL" SET "BOOTSVC=INSTALL"&&CALL:AUTOBOOT_SVC&ECHO.AutoBoot switcher is installed +IF "%ARG1%"=="-BOOTMAKER" CALL:COMMAND_BOOTMAKER +IF "%ARG1%"=="-DISKMGR" CALL:COMMAND_DISKMGR +IF "%ARG1%"=="-IMAGEMGR" CALL:COMMAND_IMAGEMGR +IF "%ARG1%"=="-IMAGEPROC" CALL:COMMAND_IMAGEPROC +GOTO:QUIT +:COMMAND_IMAGEPROC +IF "%ARG2%"=="-WIM" IF DEFINED ARG3 IF NOT EXIST "%IMAGE_FOLDER%\%ARG3%" ECHO.WIM %IMAGE_FOLDER%\%ARG3% doesn't exist&&EXIT /B +IF "%ARG2%"=="-VHDX" IF DEFINED ARG3 IF NOT EXIST "%IMAGE_FOLDER%\%ARG3%" ECHO.VHDX %IMAGE_FOLDER%\%ARG3% doesn't exist&&EXIT /B +IF "%ARG2%"=="-WIM" IF DEFINED ARG3 IF EXIST "%IMAGE_FOLDER%\%ARG3%" IF "%ARG4%"=="-INDEX" IF DEFINED ARG5 IF "%ARG6%"=="-VHDX" IF DEFINED ARG7 IF "%ARG8%"=="-SIZE" IF DEFINED ARG9 SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX"&&SET "WIM_SOURCE=%ARG3%"&&SET "WIM_INDEX=%ARG5%"&&SET "VHDX_TARGET=%ARG7%"&&SET "VHDX_SIZE=%ARG9%"&&CALL:IMAGEPROC_START +IF "%ARG2%"=="-VHDX" IF DEFINED ARG3 IF EXIST "%IMAGE_FOLDER%\%ARG3%" IF "%ARG4%"=="-INDEX" IF DEFINED ARG5 IF "%ARG6%"=="-WIM" IF DEFINED ARG7 IF "%ARG8%"=="-XLVL" IF DEFINED ARG9 SET "SOURCE_TYPE=VHDX"&&SET "TARGET_TYPE=WIM"&&SET "VHDX_SOURCE=%ARG3%"&&SET "WIM_INDEX=%ARG5%"&&SET "WIM_TARGET=%ARG7%"&&SET "WIM_XLVL=%ARG9%"&&CALL:IMAGEPROC_START +EXIT /B +:COMMAND_IMAGEMGR +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-LIST" IF DEFINED ARG4 IF NOT EXIST "%LIST_FOLDER%\%ARG4%" ECHO.%LIST_FOLDER%\%ARG4% doesn't exist&&EXIT /B +IF "%ARG2%"=="-RUN" IF "%ARG5%"=="-VHDX" IF DEFINED ARG6 IF NOT EXIST "%IMAGE_FOLDER%\%ARG6%" ECHO.%IMAGE_FOLDER%\%ARG6% doesn't exist&&EXIT /B +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" CALL:MOUNT_CLEAR&&IF DEFINED ARG4 SET "PARSE_X="&&FOR /F "TOKENS=1-9* DELIMS=[]" %%a in ('ECHO.%ARG0%') DO (IF "%%b"=="COMMAND" SET "PARSE_X=1"&&SET "ARG4=[%%b][%%c][%%d][%%e]"&&SET "ARGZ=5"&&CALL SET "ARGX=%%f"&&CALL:ARGUE) +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" CALL:MOUNT_REST&&IF DEFINED PARSE_X FOR /F "TOKENS=1-6* DELIMS= " %%a in ('ECHO.%ARG5%') DO (SET "ARG5=%%a"&&SET "ARG6=%%b"&&SET "ARG7=%%c"&&SET "ARG8=%%d"&&SET "ARG9=%%e") +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" IF DEFINED PARSE_X SET "PARSE_X="&&FOR %%a in (5 6 7 8 9) DO (SET "CAPS_SET=ARG%%a"&&CALL SET "CAPS_VAR=%%ARG%%a%%"&&CALL:CAPS_SET) +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-ITEM" IF DEFINED ARG4 SET "DEL_Z=1"&&SET "ARG3=-LIST"&&SET "ARG4=$LSTZ"&&(ECHO.EXEC-LIST&&ECHO.%ARG4%)>"%LIST_FOLDER%\$LSTZ" +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-LIST" IF DEFINED ARG4 IF EXIST "%LIST_FOLDER%\%ARG4%" SET "$RUN=%LIST_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-LIVE" SET "LIVE_APPLY=1"&&SET "CURR_SESSION=EXEC"&&SET "LST_SESSION=1"&&CALL:LIST_RUN +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-LIST" IF DEFINED ARG4 IF EXIST "%LIST_FOLDER%\%ARG4%" SET "$RUN=%LIST_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-VHDX" SET "LIVE_APPLY="&&IF DEFINED ARG6 IF EXIST "%IMAGE_FOLDER%\%ARG6%" SET "VDISK=%IMAGE_FOLDER%\%ARG6%"&&SET "CURR_SESSION=EXEC"&&SET "LST_SESSION=1"&&SET "VDISK_FLAG=1"&&CALL:LIST_RUN +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-PKX" IF DEFINED ARG4 IF EXIST "%PACK_FOLDER%\%ARG4%" SET "PKX_PACK=%PACK_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-LIVE" SET "LIVE_APPLY=1"&&SET "CURR_SESSION=PACK"&&SET "PKX_SESSION=1"&&CALL:PKX_RUN +IF "%ARG2%"=="-RUN" IF "%ARG3%"=="-PKX" IF DEFINED ARG4 IF EXIST "%PACK_FOLDER%\%ARG4%" SET "PKX_PACK=%PACK_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-VHDX" SET "LIVE_APPLY="&&IF DEFINED ARG6 IF EXIST "%IMAGE_FOLDER%\%ARG6%" SET "VDISK=%IMAGE_FOLDER%\%ARG6%"&&SET "CURR_SESSION=PACK"&&SET "PKX_SESSION=1"&&SET "VDISK_FLAG=1"&&CALL:PKX_RUN +SET "VDISK_FLAG="&&SET "CURR_SESSION="&&SET "LST_SESSION="&&SET "PKX_SESSION="&&IF DEFINED DEL_Z SET "DEL_Z="&&DEL /Q /F "%LIST_FOLDER%\$LSTZ">NUL 2>&1 +EXIT /B +:COMMAND_DISKMGR +IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "DISK_TARGET=%ARG4%"&&CALL:DISK_DETECT>NUL 2>&1 +IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "ARG3=-DISK"&&SET "ARG4=%DISK_DETECT%" +IF DEFINED ARG2 IF "%ARG3%"=="-DISK" IF "%DISK_TARGET%"=="00000000" ECHO.Disk uid 00000000 can not be addressed by uid. Convert to GPT first (erase).&&EXIT /B +IF "%ARG2%"=="-LIST" CALL:DISK_LIST +IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&CALL:DISK_DETECT>NUL 2>&1 +IF "%ARG3%"=="-DISK" IF DEFINED ARG4 CALL SET "DISK_TARGET=%%DISKID_%DISK_NUMBER%%%"&&CALL:DISK_DETECT>NUL 2>&1 +IF "%ARG2%"=="-INSPECT" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&CALL:DISKMGR_INSPECT +IF "%ARG2%"=="-ERASE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&SET "$GET=TST_LETTER"&&CALL:LETTER_ANY&&CALL:DISKMGR_ERASE&SET "TST_LETTER=" +IF "%ARG2%"=="-CHANGEUID" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&SET "GET_DISK_ID=%ARG5%"&&CALL:DISKMGR_CHANGEID +IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-SIZE" IF DEFINED ARG6 SET "PART_SIZE=%ARG6%"&&CALL:DISKMGR_CREATE +IF "%ARG2%"=="-FORMAT" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-PART" IF DEFINED ARG6 SET "PART_NUMBER=%ARG6%"&&CALL:DISKMGR_FORMAT +IF "%ARG2%"=="-DELETE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-PART" IF DEFINED ARG6 SET "PART_NUMBER=%ARG6%"&&CALL:DISKMGR_DELETE +IF "%ARG2%"=="-MOUNT" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&IF "%ARG5%"=="-PART" IF DEFINED ARG6 SET "PART_NUMBER=%ARG6%"&&IF "%ARG7%"=="-LETTER" IF DEFINED ARG8 SET "DISK_LETTER=%ARG8%"&&CALL:DISKMGR_MOUNT +IF "%ARG2%"=="-MOUNT" IF "%ARG3%"=="-VHDX" IF EXIST "%IMAGE_FOLDER%\%ARG4%" SET "VDISK=%IMAGE_FOLDER%\%ARG4%"&&IF "%ARG5%"=="-LETTER" IF DEFINED ARG6 SET "VDISK_LTR=%ARG6%"&&CALL:VDISK_ATTACH +IF "%ARG2%"=="-UNMOUNT" IF "%ARG3%"=="-LETTER" IF DEFINED ARG4 SET "$LTR=%ARG4%"&&CALL:DISKMGR_UNMOUNT +EXIT /B +:COMMAND_BOOTMAKER +IF "%ARG2%"=="-CREATE" IF NOT EXIST "%BOOT_FOLDER%\BOOT.SAV" ECHO.BOOT MEDIA %BOOT_FOLDER%\BOOT.SAV doesn't exist&&EXIT /B +IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "DISK_TARGET=%ARG4%"&&CALL:DISK_DETECT>NUL 2>&1 +IF DEFINED ARG2 IF "%ARG3%"=="-DISKUID" IF DEFINED ARG4 SET "ARG3=-DISK"&&SET "ARG4=%DISK_DETECT%" +IF DEFINED ARG2 IF "%ARG3%"=="-DISK" IF "%DISK_TARGET%"=="00000000" ECHO.Disk uid 00000000 can not addressed by uid. Convert to GPT first (erase).&&EXIT /B +IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 SET "DISK_NUMBER=%ARG4%"&&CALL:DISK_DETECT>NUL 2>&1 +IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 CALL SET "DISK_TARGET=%%DISKID_%DISK_NUMBER%%%"&&CALL:DISK_DETECT>NUL 2>&1 +IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 IF "%ARG7%"=="-SIZE" IF DEFINED ARG8 SET "HOST_SIZE=%ARG8%"&&SET "CHECK=NUM"&&SET "CHECK_VAR=%ARG8%"&&CALL:CHECK +IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 IF "%ARG7%"=="-SIZE" IF DEFINED ARG8 IF DEFINED ERROR ECHO. %XLR4%ERROR:%#$% Invalid host partition size.&&EXIT /B +IF "%ARG2%"=="-CREATE" IF "%ARG3%"=="-DISK" IF DEFINED ARG4 IF DEFINED ARG6 SET "VHDX_SLOTX=%ARG6%"&&CALL:BOOT_CREATOR_START +EXIT /B +:COMMAND_HELP +ECHO. Command Line Parameters: +ECHO. %##%Miscellaneous%#$% +ECHO. -help This menu +ECHO. -nextboot -vhdx Schedule next boot to vhdx +ECHO. -nextboot -recovery Schedule next boot to recovery +ECHO. -autoboot -install Install reboot to recovery switcher service +ECHO. -autoboot -remove Remove reboot to recovery switcher service +ECHO. %##%Image Processing%#$% +ECHO. -imageproc -wim %#@%x.wim%#$% -index %#@%#%#$% -vhdx %#@%x.vhdx%#$% -size %#@%MB%#$% WIM to VHDX Conversion +ECHO. -imageproc -vhdx %#@%x.vhdx%#$% -index %#@%#%#$% -wim %#@%x.wim%#$% -xlvl %#@%fast/max%#$% VHDX to WIM Conversion +ECHO. Examples- +ECHO. %#@%-imageproc -wim x.wim -index 1 -vhdx x.vhdx -size 25600%#$% +ECHO. %#@%-imageproc -vhdx x.vhdx -index 1 -wim x.wim -xlvl fast%#$% +ECHO. %##%Image Management%#$% +ECHO. -imagemgr -run -list %#@%x.list%#$% -live /or/ -vhdx %#@%x.vhdx%#$% Run list +ECHO. -imagemgr -run -item %#@%"[x][x][x][x]"%#$% -live /or/ -vhdx %#@%x.vhdx%#$% Run item +ECHO. -imagemgr -run -pkx %#@%x.pkx%#$% -live /or/ -vhdx %#@%x.vhdx%#$% Run Package w/integrated list +ECHO. Examples- +ECHO. %#@%-imagemgr -run -list "x y z.list" -live%#$% +ECHO. %#@%-imagemgr -run -pkx x.pkx -vhdx x.vhdx%#$% +ECHO. %#@%-imagemgr -run -item "[EXTPACKAGE][x y z.appx][INSTALL][IA]" -vhdx x.vhdx%#$% +ECHO. %##%File Management%#$% +ECHO. -filemgr -grant %#@%file/folder%#$% Take ownership + Grant Permissions +ECHO. Examples- +ECHO. %#@%-filemgr -grant c:\x.txt%#$% +ECHO. %##%Disk Management%#$% +ECHO. -diskmgr -list Condensed list of disks +ECHO. -diskmgr -inspect -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% DiskPart inquiry on specified disk +ECHO. -diskmgr -erase -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% Delete all partitions on specified disk +ECHO. -diskmgr -create -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -size %#@%MB%#$% Create NTFS partition on specified disk +ECHO. -diskmgr -format -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -part %#@%#%#$% Format partition w/NTFS on specified disk +ECHO. -diskmgr -delete -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -part %#@%#%#$% Delete partition on specified disk +ECHO. -diskmgr -changeuid -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% %#@%new-uid%#$% Change disk uid of specified disk +ECHO. -diskmgr -mount -disk %#@%#%#$% /or/ -diskuid %#@%uid%#$% -part %#@%#%#$% -letter %#@%letter%#$% Assign drive letter +ECHO. -diskmgr -unmount -letter %#@%letter%#$% Remove drive letter +ECHO. -diskmgr -mount -vhdx %#@%x.vhdx%#$% -letter %#@%letter%#$% Mount virtual disk +ECHO. Examples- +ECHO. %#@%-diskmgr -create -disk 0 -size 25600%#$% +ECHO. %#@%-diskmgr -mount -disk 0 -part 1 -letter e%#$% +ECHO. %#@%-diskmgr -unmount -letter e%#$% +ECHO. %##%Boot Creator%#$% +ECHO. -bootmaker -create -disk %#@%#%#$% -vhdx %#@%x.vhdx%#$% Erase specified disk and make bootable +ECHO. -bootmaker -create -diskuid %#@%uid%#$% -vhdx %#@%x.vhdx%#$% -size %#@%MB%#$% Erase specified disk and make bootable + set host partition size +ECHO. Examples- +ECHO. %#@%-bootmaker -create -disk 0 -vhdx x.vhdx%#$% Default is the entire disk when size is not specified +ECHO. %#@%-bootmaker -create -diskuid 12345678-1234-1234-1234-123456781234 -vhdx x.vhdx -size 100000%#$% +ECHO.&&PAUSE +EXIT /B +:DISCLAIMER +CLS&&CALL:PAD_LINE&&CALL:BOXT1 +ECHO. %XLR2%DISCLAIMER%#$%&&ECHO. +ECHO. It's recommended to backup your data before making any changes +ECHO. to the live operating system or performing disk partitioning. +ECHO. Running this tool on a host-OS language other than english +ECHO. can cause serious malfunctions and is not recommended. +ECHO. +ECHO. The user assumes liability for loss relating to the use of this tool. +ECHO.&&ECHO. Do You Agree? (%##%Y%#$%/%##%N%#$%) +ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "PROMPT_SET=ACCEPTX"&&CALL:PROMPT_SET +IF "%ACCEPTX%"=="Y" SET "DISCLAIMER=ACCEPTED" +IF NOT "%DISCLAIMER%"=="ACCEPTED" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. The ( %##%@%#$% ) %##%Current Environment%#$% option ^& disk management area&&ECHO. are the 'caution zones' and can be avoided if unsure.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAUSED +EXIT /B +::######################################################################### :SETTINGS_MENU ::######################################################################### -IF NOT DEFINED SHORT_SLOT SET "SHORT_SLOT=1" CLS&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Settings Configuration&&ECHO. -ECHO. (%##%-%#$%) Color Shift (%##%+%#$%)&&ECHO. (%##%1%#$%) Pad Type %#@%PAD %PAD_TYPE%%#$%&&ECHO. (%##%2%#$%) Pad Size %#@%%PAD_SIZE%%#$%&&ECHO. (%##%3%#$%) Pad Sequence %#@%%PAD_SEQ%%#$%&&CALL ECHO. (%##%4%#$%) Text Color %#@%COLOR %%XLR%TXT_COLOR%%%%TXT_COLOR%%#$%&&CALL ECHO. (%##%5%#$%) Accent Color %#@%COLOR %%XLR%ACC_COLOR%%%%ACC_COLOR%%#$%&&CALL ECHO. (%##%6%#$%) Button Color %#@%COLOR %%XLR%BTN_COLOR%%%%BTN_COLOR%%#$%&&CALL ECHO. (%##%7%#$%) Pad Box %#@%%PAD_BOX%%#$%&&ECHO. (%##%8%#$%) Folder Layout %#@%%FOLDER_MODE%%#$%&&ECHO. (%##%9%#$%) Shortcuts %#@%%SHORTCUTS%%#$%&&ECHO. (%##%@%#$%) Clear Settings&&ECHO. (%##%*%#$%) %XLR2%Enable Custom Menu%#$%&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE +ECHO. (%##%-%#$%) Color Shift (%##%+%#$%)&&ECHO. (%##%1%#$%) Pad Type %#@%PAD %PAD_TYPE%%#$%&&ECHO. (%##%2%#$%) Pad Size %#@%%PAD_SIZE%%#$%&&ECHO. (%##%3%#$%) Pad Sequence %#@%%PAD_SEQ%%#$%&&CALL ECHO. (%##%4%#$%) Text Color %#@%COLOR %%XLR%TXT_COLOR%%%%TXT_COLOR%%#$%&&CALL ECHO. (%##%5%#$%) Accent Color %#@%COLOR %%XLR%ACC_COLOR%%%%ACC_COLOR%%#$%&&CALL ECHO. (%##%6%#$%) Button Color %#@%COLOR %%XLR%BTN_COLOR%%%%BTN_COLOR%%#$%&&CALL ECHO. (%##%7%#$%) Pad Box %#@%%PAD_BOX%%#$%&&ECHO. (%##%8%#$%) Folder Layout %#@%%FOLDER_MODE%%#$%&&ECHO. (%##%9%#$%) Shortcuts %#@%%SHORTCUTS%%#$%&&IF "%PROG_MODE%"=="RAMDISK" ECHO. (%##%10%#$%) Update&&ECHO. (%##%11%#$%) Host Hide %#@%%HOST_HIDE%%#$% +ECHO. (%##%@%#$%) Clear Settings&&ECHO. (%##%*%#$%) %XLR2%Enable Custom Menu%#$%&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE IF "%SHORTCUTS%"=="ENABLED" CALL ECHO. [%#@%SHORTCUTS%#$%] (%##%X%#$%)Slot %#@%%SHORT_SLOT%%#$% (%##%A%#$%)ssign %#@%%%SHORT_%SHORT_SLOT%%%%#$% (%##%H%#$%)otKey %#@%%%HOTKEY_%SHORT_SLOT%%%%#$%&&CALL:PAD_LINE CALL:PAD_PREV&&CALL:MENU_SELECT IF NOT DEFINED SELECT GOTO:MAIN_MENU IF DEFINED HOST_ERROR GOTO:MAIN_MENU +IF "%SELECT%"=="@" CALL:SETS_CLEAR&SET "SELECT=" IF "%SELECT%"=="+" CALL:COLOR_SHIFT_TXT&SET "SELECT=" IF "%SELECT%"=="-" CALL:COLOR_SHIFT_PAD&SET "SELECT=" -IF "%SELECT%"=="@" CALL:SETS_CLEAR&SET "SELECT=" -IF "%SELECT%"=="8" CALL:FOLDER_MODE&SET "SELECT=" -IF "%SELECT%"=="A" IF "%SHORTCUTS%"=="ENABLED" CALL:SHORTCUTS&SET "SELECT=" -IF "%SELECT%"=="H" IF "%SHORTCUTS%"=="ENABLED" CALL:SHORTCUTS&SET "SELECT=" -IF "%SELECT%"=="7" IF "%PAD_BOX%"=="DISABLED" SET "PAD_BOX=ENABLED"&SET "SELECT=" -IF "%SELECT%"=="7" IF "%PAD_BOX%"=="ENABLED" SET "PAD_BOX=DISABLED"&SET "SELECT=" -IF "%SELECT%"=="9" IF "%SHORTCUTS%"=="DISABLED" SET "SHORTCUTS=ENABLED"&SET "SELECT=" -IF "%SELECT%"=="9" IF "%SHORTCUTS%"=="ENABLED" SET "SHORTCUTS=DISABLED"&SET "SELECT=" -IF "%SELECT%"=="X" SET /A "SHORT_SLOT+=1"&&IF "%SHORT_SLOT%"=="5" SET "SHORT_SLOT=1"&SET "SELECT=" IF "%SELECT%"=="1" CALL:PAD_TYPE&SET "SELECT=" IF "%SELECT%"=="2" IF "%PAD_SIZE%"=="LARGE" SET "PAD_SIZE=SMALL"&SET "SELECT=" IF "%SELECT%"=="2" IF "%PAD_SIZE%"=="SMALL" SET "PAD_SIZE=LARGE"&SET "SELECT=" @@ -963,6 +612,17 @@ IF "%SELECT%"=="3" IF "%XNTX%"=="10" SET "PAD_SEQ=%COLOR_XXX%"&&SET "COLOR_XXX=" IF "%SELECT%"=="4" SET "COLOR_TMP=TXT_COLOR"&&CALL:COLOR_CHOICE&SET "SELECT=" IF "%SELECT%"=="5" SET "COLOR_TMP=ACC_COLOR"&&CALL:COLOR_CHOICE&SET "SELECT=" IF "%SELECT%"=="6" SET "COLOR_TMP=BTN_COLOR"&&CALL:COLOR_CHOICE&SET "SELECT=" +IF "%SELECT%"=="7" IF "%PAD_BOX%"=="DISABLED" SET "PAD_BOX=ENABLED"&SET "SELECT=" +IF "%SELECT%"=="7" IF "%PAD_BOX%"=="ENABLED" SET "PAD_BOX=DISABLED"&SET "SELECT=" +IF "%SELECT%"=="8" CALL:FOLDER_MODE&SET "SELECT=" +IF "%SELECT%"=="9" IF "%SHORTCUTS%"=="DISABLED" SET "SHORTCUTS=ENABLED"&SET "SELECT=" +IF "%SELECT%"=="9" IF "%SHORTCUTS%"=="ENABLED" SET "SHORTCUTS=DISABLED"&SET "SELECT=" +IF "%SELECT%"=="A" IF "%SHORTCUTS%"=="ENABLED" CALL:SHORTCUTS&SET "SELECT=" +IF "%SELECT%"=="H" IF "%SHORTCUTS%"=="ENABLED" CALL:SHORTCUTS&SET "SELECT=" +IF "%SELECT%"=="X" SET /A "SHORT_SLOT+=1"&&IF "%SHORT_SLOT%"=="5" SET "SHORT_SLOT=1"&SET "SELECT=" +IF "%SELECT%"=="10" IF "%PROG_MODE%"=="RAMDISK" GOTO:UPDATE_RECOVERY +IF "%SELECT%"=="11" IF "%PROG_MODE%"=="RAMDISK" IF "%HOST_HIDE%"=="DISABLED" SET "HOST_HIDE=ENABLED"&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO.VHDX host partition will be hidden upon exit. Boot into recovery to revert.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAUSED&SET "SELECT=" +IF "%SELECT%"=="11" IF "%PROG_MODE%"=="RAMDISK" IF "%HOST_HIDE%"=="ENABLED" SET "HOST_HIDE=DISABLED"&&SET "SELECT=" IF "%SELECT%"=="*" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. %XLR4%Attention: This is an advanced feature%#$%&&ECHO. Proceeding will load menu.list instead of the main menu.&&ECHO.&&ECHO. Press (%##%X%#$%) to proceed&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "PROMPT_SET=SELECTX"&&CALL:PROMPT_SET IF "%SELECT%"=="*" IF "%SELECTX%"=="X" SET "SELECT="&&SET "MENU_MODE=CUSTOM"&&CALL:CUSTOM_MAKE&&GOTO:CUSTOM_MODE GOTO:SETTINGS_MENU @@ -1013,27 +673,236 @@ IF "%SELECT%"=="%HOTKEY_5%" SET "SHORT_RUN=%SHORT_5%" IF NOT DEFINED SHORT_RUN EXIT /B CALL START %SHORT_RUN% EXIT /B -:AUTOBOOT_COUNT -IF EXIST "Z:\$\ERR.TXT" SET "AUTOBOOT=DISABLED"&&DEL "Z:\$\ERR.TXT"&&MOVE /Y "Z:\$\AutoBoot.cmd" "Z:\$\AutoBoot.txt">NUL&EXIT /B -ECHO.AUTOBOOT ERROR>Z:\$\ERR.TXT -ECHO.@ECHO OFF>X:\COUNT.CMD -ECHO.FOR %%%%a in (20 19 18 17 16 15 14 13 13 12 11 10 9 8 7 6 5 4 3 2 1 0) DO (CLS^&^&ECHO.AutoBoot starts in %%%%a seconds...^&^&PING -n 2 127.0.0.1^>NUL)>>X:\COUNT.CMD -ECHO.CD /D Z:\$^&CALL Z:\$\AutoBoot.cmd>>X:\COUNT.CMD -ECHO.ECHO.AutoBoot Finished. Restarting in 5 Seconds^&PING -n 6 127.0.0.1^>NUL>>X:\COUNT.CMD -ECHO.DEL /Q /F Z:\$\ERR.TXT^>NUL>>X:\COUNT.CMD -ECHO.EXIT^&^&EXIT>>X:\COUNT.CMD -CALL:PAD_LINE&&CALL:BOXT1&&ECHO. To cancel AutoBoot close countdown window. -ECHO. Press (N) to return to recovery. Press (Y) for command prompt.&&CALL:BOXB1&&CALL:PAD_LINE -START /WAIT X:\COUNT.CMD -IF EXIST "Z:\$\ERR.TXT" SET "AUTOBOOT=DISABLED"&&DEL "Z:\$\ERR.TXT"&&MOVE /Y "Z:\$\AutoBoot.cmd" "Z:\$\AutoBoot.txt">NUL +:AUTOBOOT_COUNT +IF EXIST "Z:\%HOST_FOLDERX%\ERR.TXT" SET "AUTOBOOT=DISABLED"&&DEL "Z:\%HOST_FOLDERX%\ERR.TXT"&&MOVE /Y "Z:\%HOST_FOLDERX%\AutoBoot.cmd" "Z:\%HOST_FOLDERX%\AutoBoot.txt">NUL&EXIT /B +ECHO.AUTOBOOT ERROR>Z:\%HOST_FOLDERX%\ERR.TXT +ECHO.@ECHO OFF>X:\COUNT.CMD +ECHO.FOR %%%%a in (20 19 18 17 16 15 14 13 13 12 11 10 9 8 7 6 5 4 3 2 1 0) DO (CLS^&^&ECHO.AutoBoot starts in %%%%a seconds...^&^&PING -n 2 127.0.0.1^>NUL)>>X:\COUNT.CMD +ECHO.CD /D Z:\%HOST_FOLDERX%^&CALL Z:\%HOST_FOLDERX%\AutoBoot.cmd>>X:\COUNT.CMD +ECHO.ECHO.AutoBoot Finished. Restarting in 5 Seconds^&PING -n 6 127.0.0.1^>NUL>>X:\COUNT.CMD +ECHO.DEL /Q /F Z:\%HOST_FOLDERX%\ERR.TXT^>NUL>>X:\COUNT.CMD +ECHO.EXIT^&^&EXIT>>X:\COUNT.CMD +CALL:PAD_LINE&&CALL:BOXT1&&ECHO. To cancel AutoBoot close countdown window. +ECHO. Press (N) to return to recovery. Press (Y) for command prompt.&&CALL:BOXB1&&CALL:PAD_LINE +START /WAIT X:\COUNT.CMD +IF EXIST "Z:\%HOST_FOLDERX%\ERR.TXT" SET "AUTOBOOT=DISABLED"&&DEL "Z:\%HOST_FOLDERX%\ERR.TXT"&&MOVE /Y "Z:\%HOST_FOLDERX%\AutoBoot.cmd" "Z:\%HOST_FOLDERX%\AutoBoot.txt">NUL +EXIT /B +:UPDATE_RECOVERY +SET "PROG_NAME=windick"&&CLS&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Recovery Update&&ECHO.&&ECHO. (%##%1%#$%) Program (%##%*%#$%) Test&&ECHO. (%##%2%#$%) Recovery Wallpaper&&ECHO. (%##%3%#$%) Recovery Password&&ECHO. (%##%4%#$%) Boot Media&&ECHO. (%##%5%#$%) Host Folder&&ECHO. (%##%6%#$%) EFI Files&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +IF DEFINED HOST_ERROR GOTO:MAIN_MENU +IF NOT DEFINED SELECT GOTO:SETTINGS_MENU +IF NOT "%SELECT%"=="*" IF NOT "%SELECT%"=="1" IF NOT "%SELECT%"=="2" IF NOT "%SELECT%"=="3" IF NOT "%SELECT%"=="4" IF NOT "%SELECT%"=="5" IF NOT "%SELECT%"=="6" GOTO:UPDATE_RECOVERY +IF "%SELECT%"=="*" IF EXIST "%PROG_SOURCE%\%PROG_NAME%.cmd" SET "VER_GET=%PROG_SOURCE%\%PROG_NAME%.cmd"&&CALL:VER_GET&© /Y "%PROG_SOURCE%\%PROG_NAME%.cmd" "%PROG_FOLDER%"&&GOTO:MAIN_MENU +FOR %%a in (0 1 2 3 ERROR) DO (IF "%FREE%"=="%%a" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Not enough free space. Clear some space and try again.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "ERROR=1"&&CALL:PAUSED&GOTO:UPDATE_END) +IF "%SELECT%"=="1" SET "UPDATE_TYPE=PROG" +IF "%SELECT%"=="2" SET "UPDATE_TYPE=WALL" +IF "%SELECT%"=="3" SET "UPDATE_TYPE=PASS" +IF "%SELECT%"=="4" SET "UPDATE_TYPE=BOOT" +IF "%SELECT%"=="5" SET "UPDATE_TYPE=HOST" +IF "%SELECT%"=="6" SET "UPDATE_TYPE=EFI" +IF "%UPDATE_TYPE%"=="EFI" IF NOT EXIST "%BOOT_FOLDER%\boot.sdi" IF NOT EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. %XLR4%ERROR:%#$% Files boot.sdi and bootmgfw.efi are not located in folder. Abort.&&SET "ERROR=1"&&CALL:PAUSED&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="BOOT" IF NOT EXIST "%BOOT_FOLDER%\boot.sav" ECHO. %XLR4%ERROR:%#$% File boot.sav is not located in folder. Abort.&&SET "ERROR=1"&&CALL:PAUSED&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="PROG" IF NOT EXIST "%PROG_SOURCE%\%PROG_NAME%.cmd" ECHO. %XLR4%ERROR:%#$% File %PROG_NAME%.cmd is not located in folder. Abort.&&SET "ERROR=1"&&CALL:PAUSED&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="PROG" SET "VER_GET=%PROG_SOURCE%\%PROG_NAME%.cmd"&&SET "VER_SET=VER_X"&&CALL:VER_GET +IF "%UPDATE_TYPE%"=="PROG" SET "VER_GET=%PROG_FOLDER%\%PROG_NAME%.cmd"&&SET "VER_SET=VER_Y"&&CALL:VER_GET +IF "%UPDATE_TYPE%"=="PASS" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. %XLR4%Important:%#$% Do not use any of these symbols [%XLR2% ^< ^> %% ^^! ^& ^^^^ %#$%].&&ECHO.&&ECHO. Enter new recovery password or leave blank to remove.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "PROMPT_SET=RECOVERY_LOCK"&&SET "PROMPT_ANY=1"&&CALL:PROMPT_SET +IF "%UPDATE_TYPE%"=="WALL" CALL:PE_WALLPAPER +IF "%UPDATE_TYPE%"=="WALL" IF NOT DEFINED $PICK SET "ERROR=1"&&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="HOST" CALL:HOST_FOLDER +IF "%UPDATE_TYPE%"=="HOST" IF DEFINED ERROR GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="BOOT" MOVE /Y "%BOOT_FOLDER%\boot.sav" "%BOOT_FOLDER%\$BOOT.wim">NUL +IF "%UPDATE_TYPE%"=="BOOT" FOR /F "TOKENS=1-9 SKIP=4 DELIMS=: " %%a in ('DISM /ENGLISH /GET-IMAGEINFO /IMAGEFILE:%BOOT_FOLDER%\$BOOT.wim /INDEX:1 2^>NUL') DO (IF "%%a"=="Version" SET "VER_X=%%b" +IF "%%a %%b"=="ServicePack Build" SET "VER_Z=%%c") +IF "%UPDATE_TYPE%"=="BOOT" MOVE /Y "%BOOT_FOLDER%\$BOOT.wim" "%BOOT_FOLDER%\boot.sav">NUL +IF "%UPDATE_TYPE%"=="BOOT" SET "VER_X=%VER_X%.%VER_Z%"&&SET "VER_Y="&&FOR /F "TOKENS=1-9 DELIMS=: " %%a in ('DISM /ENGLISH /ONLINE /GET-CURRENTEDITION 2^>NUL') DO (IF "%%a %%b"=="Image Version" SET "VER_Y=%%c") +CALL:PAD_LINE&&CALL:BOXT1&&ECHO. +IF "%UPDATE_TYPE%"=="EFI" ECHO. This will replace the current EFI boot files. +IF "%UPDATE_TYPE%"=="BOOT" ECHO. This will replace %#@%v%VER_Y%%#$% with %#@%v%VER_X%%#$% +IF "%UPDATE_TYPE%"=="PROG" ECHO. This will replace %#@%v%VER_Y%%#$% with %#@%v%VER_X%%#$%. +IF "%UPDATE_TYPE%"=="PASS" IF DEFINED RECOVERY_LOCK ECHO. Recovery password will be changed to %#@%%RECOVERY_LOCK%%#$%. +IF "%UPDATE_TYPE%"=="PASS" IF NOT DEFINED RECOVERY_LOCK ECHO. Recovery password will be cleared. +IF "%UPDATE_TYPE%"=="WALL" ECHO. This will replace the recovery background. +IF "%UPDATE_TYPE%"=="HOST" ECHO. Host folder will be changed to %#@%%HOST_FOLDER%%#$%.&&ECHO. %XLR4%NOTE:%#$% The boot menu will need to be configured next boot. +ECHO.&&CALL:BOXB1&&CALL:CONFIRM +IF NOT "%CONFIRM%"=="X" SET "ERROR=1"&&GOTO:UPDATE_END +SET "REBOOT_MAN=1"&&CLS&&CALL:BOXT2&&ECHO. %XLR4%Recovery update has been initiated.%#$%&&ECHO. %XLR2%Caution:%#$% Interrupting this process can render the disk unbootable.&&ECHO. +IF "%UPDATE_TYPE%"=="HOST" IF EXIST "Z:\%HOST_FOLDER%" ECHO. %XLR2%ERROR:%#$% HOST FOLDER ALREADY EXISTS&&SET "ERROR=1"&&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="HOST" REN "Z:\%HOST_FOLDERX%" "%HOST_FOLDER%">NUL 2>&1 +IF "%UPDATE_TYPE%"=="HOST" IF NOT EXIST "Z:\%HOST_FOLDER%" ECHO. %XLR2%ERROR:%#$% HOST FOLDER IN USE&&SET "ERROR=1"&&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="HOST" REN "Z:\%HOST_FOLDER%" "%HOST_FOLDERX%">NUL 2>&1 +CALL:EFI_MOUNT +IF DEFINED ERROR GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="EFI" IF EXIST "%BOOT_FOLDER%\boot.sdi" ECHO. Using boot.sdi located in folder, for efi image boot support.&© /Y "%BOOT_FOLDER%\boot.sdi" "%EFI_LETTER%:\Boot">NUL +IF "%UPDATE_TYPE%"=="EFI" IF EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. Using bootmgfw.efi located in folder, for the efi bootloader.&© /Y "%BOOT_FOLDER%\bootmgfw.efi" "%EFI_LETTER%:\EFI\Boot\bootx64.efi">NUL +IF "%UPDATE_TYPE%"=="EFI" FOR %%a in (boot.sdi bootmgfw.efi) DO (IF NOT EXIST "%BOOT_FOLDER%\%%a" ECHO. File %%a is not located in folder, skipping.) +IF "%UPDATE_TYPE%"=="EFI" ECHO. Unmounting EFI...&&CALL:EFI_UNMOUNT&GOTO:UPDATE_END +CALL:VTEMP_CREATE +IF DEFINED ERROR CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END +ECHO. Extracting boot-media... +IF "%UPDATE_TYPE%"=="BOOT" MOVE /Y "%BOOT_FOLDER%\boot.sav" "%BOOT_FOLDER%\$BOOT.wim">NUL +IF "%UPDATE_TYPE%"=="BOOT" SET "INDEX_WORD=Setup"&&SET "IMAGEFILE=%BOOT_FOLDER%\$BOOT.wim"&&CALL:FIND_INDEX +IF "%UPDATE_TYPE%"=="BOOT" SET "IMAGEFILE=%BOOT_FOLDER%\$BOOT.wim"&&CALL:APPLY_IMAGE +IF "%UPDATE_TYPE%"=="BOOT" MOVE /Y "%BOOT_FOLDER%\$BOOT.wim" "%BOOT_FOLDER%\boot.sav">NUL +IF NOT "%UPDATE_TYPE%"=="BOOT" SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:APPLY_IMAGE +IF NOT EXIST "%APPLYDIR%\Windows" ECHO. %XLR2%ERROR:%#$% BOOT MEDIA&&SET "ERROR=1"&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT&GOTO:UPDATE_END +IF "%UPDATE_TYPE%"=="BOOT" MD "%APPLYDIR%\$">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" COPY /Y "%PROG_FOLDER%\%PROG_NAME%.cmd" "%APPLYDIR%\$">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" COPY /Y "%PROG_FOLDER%\HOST_TARGET" "%APPLYDIR%\$">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" COPY /Y "%PROG_FOLDER%\HOST_FOLDER" "%APPLYDIR%\$">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" COPY /Y "%WINDIR%\System32\setup.bmp" "%APPLYDIR%\Windows\System32">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" IF EXIST "%PROG_FOLDER%\RECOVERY_LOCK" COPY /Y "%PROG_FOLDER%\RECOVERY_LOCK" "%APPLYDIR%\$">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" IF NOT EXIST "%PROG_FOLDER%\RECOVERY_LOCK" DEL /Q /F "\\?\%APPLYDIR%\$\RECOVERY_LOCK">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" IF EXIST "%APPLYDIR%\setup.exe" DEL /Q /F "\\?\%APPLYDIR%\setup.exe">NUL 2>&1 +REM IF "%UPDATE_TYPE%"=="BOOT" COPY /Y "%APPLYDIR%\Windows\Boot\DVD\EFI\boot.sdi" "%EFI_LETTER%:\Boot">NUL 2>&1 +REM IF "%UPDATE_TYPE%"=="BOOT" COPY /Y "%APPLYDIR%\Windows\Boot\EFI\bootmgfw.efi" "%EFI_LETTER%:\EFI\Boot\bootx64.efi">NUL 2>&1 +IF "%UPDATE_TYPE%"=="BOOT" (ECHO.[LaunchApp]&&ECHO.AppPath=X:\$\%PROG_NAME%.cmd)>"%APPLYDIR%\Windows\System32\winpeshl.ini" +IF "%UPDATE_TYPE%"=="BOOT" ECHO. Updating boot media %#@%v%VER_Y%%#$% to %#@%v%VER_X%%#$%. +IF "%UPDATE_TYPE%"=="PROG" ECHO. Updating %PROG_NAME%.cmd %#@%v%VER_Y%%#$% to %#@%v%VER_X%%#$%.&© /Y "%PROG_SOURCE%\%PROG_NAME%.cmd" "%APPLYDIR%\$">NUL +IF "%UPDATE_TYPE%"=="PASS" IF DEFINED RECOVERY_LOCK ECHO. Recovery password will be changed to %#@%%RECOVERY_LOCK%%#$%.&&ECHO.%RECOVERY_LOCK%>"%APPLYDIR%\$\RECOVERY_LOCK" +IF "%UPDATE_TYPE%"=="PASS" IF NOT DEFINED RECOVERY_LOCK ECHO. Recovery password will be cleared.&&DEL /Q /F "\\?\%APPLYDIR%\$\RECOVERY_LOCK">NUL 2>&1 +IF "%UPDATE_TYPE%"=="WALL" ECHO. Using %PE_WALLPAPER% located in folder for the recovery wallpaper. +IF "%UPDATE_TYPE%"=="WALL" TAKEOWN /F "%APPLYDIR%\Windows\System32\setup.bmp">NUL 2>&1 +IF "%UPDATE_TYPE%"=="WALL" ICACLS "%APPLYDIR%\Windows\System32\setup.bmp" /grant %USERNAME%:F>NUL 2>&1 +IF "%UPDATE_TYPE%"=="WALL" COPY /Y "%CACHE_FOLDER%\%PE_WALLPAPER%" "%APPLYDIR%\Windows\System32\setup.bmp">NUL 2>&1 +IF "%UPDATE_TYPE%"=="HOST" ECHO. Host folder will be changed to %#@%%HOST_FOLDER%%#$%.&&ECHO.%HOST_FOLDER%>"%APPLYDIR%\$\HOST_FOLDER" +ECHO. Saving boot-media...&&DEL /Q /F "%EFI_LETTER%:\$.WIM">NUL 2>&1 +SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:CAPTURE_IMAGE +ECHO. Unmounting EFI...&&CALL:VTEMP_DELETE&CALL:EFI_UNMOUNT +GOTO:UPDATE_END +:UPDATE_END +IF "%UPDATE_TYPE%"=="HOST" IF NOT DEFINED ERROR REN "Z:\%HOST_FOLDERX%" "%HOST_FOLDER%">NUL 2>&1 +IF NOT DEFINED ERROR FOR %%a in (Z:\%HOST_FOLDER% Z:) DO (ICACLS "%%a" /deny everyone:^(DE,WA,WDAC^)>NUL 2>&1) +IF DEFINED REBOOT_MAN ECHO.&&ECHO. THE SYSTEM WILL NOW RESTART.&&ECHO.&&ECHO. %#@%UPDATE FINISH:%#$% %DATE% %TIME%&&CALL:BOXB2&&CALL:PAUSED&GOTO:QUIT +SET "VER_X="&&SET "VER_Y="&&SET "VER_Z="&&SET "RECOVERY_LOCK="&&GOTO:UPDATE_RECOVERY +:PE_WALLPAPER +CLS&&SET "MENUT0= Recovery Wallpaper"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE JPGs/PNGs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%CACHE_FOLDER%"&&SET "$FILT0=*.JPG *.PNG"&&CALL:FILE_PICK +IF "%SELECT%"=="." SET "FILE_TYPE=WALL"&&CALL:BASIC_FILE&EXIT /B +IF DEFINED $PICK SET "PE_WALLPAPER=%$TRUMP%" +IF NOT DEFINED $PICK SET "PE_WALLPAPER=SELECT" +EXIT /B +:HOST_FOLDER +CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter the host folder name&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_ANY=1"&&CALL SET "PROMPT_SET=SELECTX"&&CALL:PROMPT_SET +IF NOT DEFINED SELECTX SET "ERROR=1"&&EXIT /B +SET "CHECK=ALPHA"&&SET "CHECK_VAR=%SELECTX%"&&CALL:CHECK +IF DEFINED ERROR CALL:PAUSED +IF NOT DEFINED ERROR SET "HOST_FOLDER=%SELECTX%" +EXIT /B +:VTEMP_CREATE +IF DEFINED ERROR EXIT /B +CALL:SCRATCH_CREATE +ECHO. Mounting temporary vdisk...&&SET "VDISK=%SCRATCHDIR%\scratch.vhdx"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_CREATE>NUL 2>&1 +IF NOT EXIST "%VDISK_LTR%:\" SET "ERROR=1" +EXIT /B +:VTEMP_DELETE +IF EXIST "%VDISK_LTR%:\" ECHO. Unmounting temporary vdisk...&&SET "VDISK=%SCRATCHDIR%\scratch.vhdx"&&CALL:VDISK_DETACH>NUL 2>&1 +IF EXIST "%PROG_SOURCE%\scratch" CALL:SCRATCH_DELETE +EXIT /B +:SCRATCH_CREATE +IF NOT DEFINED SCRATCHDIR SET "SCRATCHDIR=%PROG_SOURCE%\scratch" +IF EXIST "%SCRATCHDIR%" SET "SCRATCHDIRX=%SCRATCHDIR%"&&CALL:SCRATCH_DELETE +IF DEFINED SCRATCHDIRX SET "SCRATCHDIR=%SCRATCHDIRX%" +IF NOT EXIST "%SCRATCHDIR%" MD "%SCRATCHDIR%">NUL 2>&1 +SET "SCRATCHDIRX=" +EXIT /B +:SCRATCH_DELETE +IF NOT DEFINED SCRATCHDIR SET "SCRATCHDIR=%PROG_SOURCE%\scratch" +IF EXIST "%SCRATCHDIR%" DISM /cleanup-MountPoints>NUL 2>&1 +IF EXIST "%SCRATCHDIR%" ATTRIB -R -S -H "%SCRATCHDIR%" /S /D /L>NUL 2>&1 +IF EXIST "%SCRATCHDIR%" RD /S /Q "%SCRATCHDIR%">NUL 2>&1 +SET "SCRATCHDIR=" +EXIT /B +:APPLY_IMAGE +IF NOT DEFINED IMAGEFILE EXIT /B +IF NOT DEFINED APPLYDIR SET "APPLYDIR=%VDISK_LTR%:" +IF NOT DEFINED IMAGEINDEX SET "IMAGEINDEX=1" +DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGEFILE%" /INDEX:%IMAGEINDEX% /APPLYDIR:"%APPLYDIR%"&ECHO.&SET "IMAGEFILE="&SET "IMAGEINDEX=" +EXIT /B +:CAPTURE_IMAGE +IF NOT DEFINED IMAGEFILE EXIT /B +IF NOT DEFINED CAPTUREDIR SET "CAPTUREDIR=%VDISK_LTR%:" +DISM /ENGLISH /CAPTURE-IMAGE /IMAGEFILE:"%IMAGEFILE%" /CAPTUREDIR:"%CAPTUREDIR%" /NAME:NAME /CheckIntegrity /Verify /Bootable&ECHO.&SET "IMAGEFILE=" +EXIT /B +:BASIC_CREATOR +@ECHO OFF&&SET "MOUNT="&&CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:FREE_CALC&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Processing / Boot Creator&&ECHO. +SET "SOURCE_LOCATION="&&FOR %%a in (A B C D E F G H I J K L N O P Q R S T U W Y Z) DO (IF EXIST "%%a:\sources\boot.wim" SET "SOURCE_LOCATION=%%a:\sources") +SET "BOOT_EXIST="&&IF EXIST "%BOOT_FOLDER%\BOOT.SAV" SET "BOOT_EXIST=1" +IF "%PROG_MODE%"=="RAMDISK" SET "BOOT_EXIST=1" +SET "WIM_EXIST="&&IF EXIST "%IMAGE_FOLDER%\*.WIM" SET "WIM_EXIST=1" +SET "VHDX_EXIST="&&IF EXIST "%IMAGE_FOLDER%\*.VHDX" SET "VHDX_EXIST=1" +SET "IMAGEPROC_GO="&&FOR %%a in (WIM_EXIST VHDX_EXIST) DO (IF DEFINED %%a SET "IMAGEPROC_GO=1") +SET "BOOTCREATE_GO="&&IF DEFINED BOOT_EXIST IF DEFINED VHDX_EXIST SET "BOOTCREATE_GO=1" +IF DEFINED SOURCE_LOCATION ECHO. (%##%-%#$%) Import Boot %XLR5%Windows Installation Media Detected%#$% Import WIM (%##%+%#$%)&&ECHO. +IF NOT DEFINED IMAGEPROC_GO ECHO. %#@%Insert a Windows Disc/ISO to import installation media%#$%&&ECHO. +IF NOT DEFINED BOOT_EXIST ECHO. %#@%Insert a Windows Disc/ISO to import boot media%#$%&&ECHO. +SET "MENUT0= %#@%AVAILABLE WIMs/VHDXs:%#$%"&&SET "MENUT1= " +IF NOT EXIST "%IMAGE_FOLDER%\*.WIM" IF NOT EXIST "%IMAGE_FOLDER%\*.VHDX" SET "MENUT0="&&SET "MENUT1=" +IF EXIST "%IMAGE_FOLDER%\*.WIM" SET "BLIST=WIM"&&CALL:FILE_LIST +IF EXIST "%IMAGE_FOLDER%\*.VHDX" SET "BLIST=VHDX"&&CALL:FILE_LIST +ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&TITLE Windows Deployment Image Customization Kit v%VER_CUR% (%PROG_SOURCE%) +IF "%PROG_MODE%"=="RAMDISK" IF DEFINED IMAGEPROC_GO IF NOT DEFINED BOOTCREATE_GO ECHO. (%##%C%#$%)onvert&&CALL:PAD_LINE +IF "%PROG_MODE%"=="RAMDISK" IF DEFINED IMAGEPROC_GO IF DEFINED BOOTCREATE_GO ECHO. (%##%C%#$%)onvert (%##%G%#$%)o^^!&&CALL:PAD_LINE +IF "%PROG_MODE%"=="PORTABLE" IF DEFINED IMAGEPROC_GO IF NOT DEFINED BOOTCREATE_GO ECHO. (%##%Q%#$%)uit (%##%*%#$%) Main Menu (%##%C%#$%)onvert %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE +IF "%PROG_MODE%"=="PORTABLE" IF DEFINED IMAGEPROC_GO IF DEFINED BOOTCREATE_GO ECHO. (%##%Q%#$%)uit (%##%*%#$%) Main Menu (%##%C%#$%)onvert (%##%G%#$%)o^^! %#@%%FREE%GB%#$% Free&&CALL:PAD_LINE +IF "%PROG_MODE%"=="RAMDISK" CALL:PAD_PREV +CALL:MENU_SELECT +IF NOT DEFINED SELECT IF "%PROG_MODE%"=="RAMDISK" GOTO:BASIC_MODE +IF DEFINED HOST_ERROR IF "%PROG_MODE%"=="RAMDISK" GOTO:BASIC_MODE +IF "%SELECT%"=="Q" GOTO:QUIT +IF "%SELECT%"=="C" CALL:CONVERT_PROMPT&SET "SELECT=" +IF "%SELECT%"=="+" IF DEFINED SOURCE_LOCATION CALL:SOURCE_IMPORT&SET "SELECT=" +IF "%SELECT%"=="-" IF DEFINED SOURCE_LOCATION CALL:BOOT_IMPORT&SET "SELECT=" +IF "%SELECT%"=="G" IF "%PROG_MODE%"=="RAMDISK" IF NOT EXIST "%BOOT_FOLDER%\boot.sav" CALL:BOOT_FETCH +IF "%SELECT%"=="G" IF EXIST "%BOOT_FOLDER%\boot.sav" CALL:CREATOR_PROMPT&SET "SELECT=" +IF "%SELECT%"=="*" IF "%PROG_MODE%"=="PORTABLE" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU +GOTO:BASIC_CREATOR +:CREATOR_PROMPT +SET "$VHDX=X"&&CALL:VHDX_CHECK +IF DEFINED ERROR EXIT /B +SET "QUERY_MSG= %XLR2%Select a disk to erase%#$%"&&CALL:DISK_MENU +IF DEFINED ERROR EXIT /B +CALL:CONFIRM +IF NOT "%CONFIRM%"=="X" EXIT /B +IF DEFINED DISK_NUMBER IF DEFINED DISK_TARGET CALL:BOOT_CREATOR_START&CALL:PAUSED +EXIT /B +:CONVERT_PROMPT +SET "MENUT0= Image Processing"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE WIMs/VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%IMAGE_FOLDER%"&&SET "$FILT0=*.WIM *.VHDX"&&CALL:FILE_PICK +IF "%SELECT%"=="." SET "FILE_TYPE=IMAGE"&&CALL:BASIC_FILE&EXIT /B +IF NOT DEFINED $PICK EXIT /B +SET "CONVERT_EXT="&&FOR %%G in ("%$PICK%") DO (SET "CAPS_SET=CONVERT_EXT"&&SET "CAPS_VAR=%%~xG"&&CALL:CAPS_SET) +IF "%CONVERT_EXT%"==".WIM" GOTO:BASIC_RESTORE_X +IF "%CONVERT_EXT%"==".VHDX" GOTO:BASIC_BACKUP_X +EXIT /B +:BASIC_BACKUP +SET "MENUT0= Image Processing"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=VHDX"&&CALL:FILE_PICK +IF "%SELECT%"=="." SET "FILE_TYPE=VHDX"&&CALL:BASIC_FILE&EXIT /B +IF NOT DEFINED $PICK EXIT /B +:BASIC_BACKUP_X +SET "VHDX_SOURCE=%$PICK_BODY%%$PICK_EXT%" +SET "SOURCE_TYPE=VHDX"&&SET "TARGET_TYPE=WIM"&&CALL:IMAGEPROC_TARGET +IF NOT DEFINED WIM_TARGET EXIT /B +IF EXIST "%IMAGE_FOLDER%\%WIM_TARGET%" ECHO.&&ECHO. %XLR4%ERROR:%#$% File already exists.&&EXIT /B +SET "WIM_INDEX=1"&&CALL:IMAGEPROC_START +EXIT /B +:BASIC_RESTORE +SET "MENUT0= Image Processing"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE WIMs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=WIM"&&CALL:FILE_PICK +IF "%SELECT%"=="." SET "FILE_TYPE=WIM"&&CALL:BASIC_FILE&EXIT /B +IF NOT DEFINED $PICK EXIT /B +:BASIC_RESTORE_X +SET "WIM_SOURCE=%$PICK_BODY%%$PICK_EXT%" +CALL:WIM_INDEX_MENU +IF DEFINED ERROR EXIT /B +SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX"&&CALL:IMAGEPROC_TARGET +IF NOT DEFINED VHDX_TARGET EXIT /B +IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" ECHO.&&ECHO. %XLR4%ERROR:%#$% File already exists.&&EXIT /B +CALL:IMAGEPROC_VSIZE +IF DEFINED ERROR EXIT /B +CALL:IMAGEPROC_START EXIT /B ::######################################################################### :IMAGE_PROCESSING ::######################################################################### -@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&IF NOT DEFINED SOURCE_TYPE SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX" +@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&IF NOT DEFINED SOURCE_TYPE SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX" SET "SOURCE_LOCATION="&&FOR %%a in (A B C D E F G H I J K L N O P Q R S T U W Y Z) DO (IF EXIST "%%a:\sources\boot.wim" SET "SOURCE_LOCATION=%%a:\sources") -IF NOT DEFINED WIM_XLVL SET "WIM_XLVL=FAST" -IF NOT DEFINED VHDX_SIZE SET "VHDX_SIZE=25600" SET "PROC_DISPLAY="&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Processing&&ECHO. IF DEFINED SOURCE_LOCATION ECHO. (%##%-%#$%)Import Boot %##%Windows Installation Media Detected%#$% Import WIM(%##%+%#$%)&&ECHO. IF NOT DEFINED SOURCE_LOCATION IF NOT EXIST "%IMAGE_FOLDER%\*.WIM" ECHO. Insert a Windows Disc/ISO/USB to Import Installation/Boot Media&&ECHO. @@ -1065,33 +934,42 @@ IF "%SELECT%"=="+" IF DEFINED SOURCE_LOCATION CALL:SOURCE_IMPORT&SET "SELECT=" IF "%SELECT%"=="-" IF DEFINED SOURCE_LOCATION CALL:BOOT_IMPORT&SET "SELECT=" GOTO:IMAGE_PROCESSING :IMAGEPROC_START -SET "ERROR="&&SET "VHDX_MB=%VHDX_SIZE%"&&IF NOT "%PROG_MODE%"=="COMMAND" CLS -CALL:BOXT2&&ECHO. %#@%IMAGE PROCESSING START:%#$% %DATE% %TIME%&&CALL:TITLECARD -IF "%SOURCE_TYPE%"=="WIM" IF "%WIM_SOURCE%"=="SELECT" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Source %SOURCE_TYPE% not set.%#$% -IF "%SOURCE_TYPE%"=="PATH" IF "%PATH_SOURCE%"=="SELECT" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Source %SOURCE_TYPE% not set.%#$% -IF "%SOURCE_TYPE%"=="VHDX" IF "%VHDX_SOURCE%"=="SELECT" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Source %SOURCE_TYPE% not set.%#$% -IF "%TARGET_TYPE%"=="WIM" IF "%WIM_TARGET%"=="SELECT" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Target %TARGET_TYPE% not set.%#$% -IF "%TARGET_TYPE%"=="VHDX" IF "%VHDX_TARGET%"=="SELECT" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Target %TARGET_TYPE% not set.%#$% -IF "%TARGET_TYPE%"=="PATH" IF "%PATH_TARGET%"=="SELECT" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Target %TARGET_TYPE% not set.%#$% -IF "%PROG_MODE%"=="COMMAND" IF "%SOURCE_TYPE%"=="PATH" IF NOT EXIST "%PATH_SOURCE%\" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Source %SOURCE_TYPE% doesn't exist.%#$% -IF "%PROG_MODE%"=="COMMAND" IF "%TARGET_TYPE%"=="PATH" IF NOT EXIST "%PATH_TARGET%\" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Target %TARGET_TYPE% doesn't exist.%#$% -IF "%PROG_MODE%"=="RAMDISK" IF "%SOURCE_TYPE%"=="PATH" IF "%PATH_SOURCE%"=="Z:" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Cannot use vhdx host partition Z:\ as a path.%#$% -IF "%PROG_MODE%"=="RAMDISK" IF "%TARGET_TYPE%"=="PATH" IF "%PATH_TARGET%"=="Z:" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Cannot use vhdx host partition Z:\ as a path.%#$% -IF "%TARGET_TYPE%"=="WIM" IF NOT DEFINED ERROR IF EXIST "%IMAGE_FOLDER%\%WIM_TARGET%" SET "ERROR=1"&&ECHO.&&ECHO. %XLR4%Target %WIM_TARGET% exists. Try another name or delete the existing file.%#$% -IF "%TARGET_TYPE%"=="VHDX" IF NOT DEFINED ERROR IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" ECHO.&&ECHO. File %#@%%VHDX_TARGET%%#$% already exists.&&ECHO. %XLR2%Note:%#$% Updating may cause errors. Try a new vhdx if having issues.&&ECHO.&&ECHO. Press (%##%X%#$%) to overwrite.&&ECHO.&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET -IF "%TARGET_TYPE%"=="VHDX" IF NOT DEFINED ERROR IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" IF NOT "%CONFIRM%"=="X" SET "ERROR=1"&&ECHO.&&ECHO. %##%Abort.%#$% -IF DEFINED ERROR GOTO:IMAGEPROC_CLEANUP +SET "SOURCE_X="&&SET "TARGET_X="&&SET "VHDX_MB=%VHDX_SIZE%"&&IF NOT "%PROG_MODE%"=="COMMAND" CLS +CALL:BOXT2&&ECHO. %#@%IMAGE PROCESSING START:%#$% %DATE% %TIME% +CALL SET "SOURCE_X=%%%SOURCE_TYPE%_SOURCE%%%" +CALL SET "TARGET_X=%%%TARGET_TYPE%_TARGET%%%" +FOR %%a in (SOURCE_X TARGET_X) DO (IF NOT DEFINED %%a SET "%%a=SELECT") +IF "%SOURCE_X%"=="SELECT" ECHO.&&ECHO. %XLR4%Source %SOURCE_TYPE% not set.%#$%&&GOTO:IMAGEPROC_END +IF "%TARGET_X%"=="SELECT" ECHO.&&ECHO. %XLR4%Target %TARGET_TYPE% not set.%#$%&&GOTO:IMAGEPROC_END +IF "%SOURCE_TYPE%"=="PATH" IF NOT EXIST "%PATH_SOURCE%\" ECHO.&&ECHO. %XLR4%Source %SOURCE_TYPE% doesn't exist.%#$%&&GOTO:IMAGEPROC_END +IF "%TARGET_TYPE%"=="PATH" IF NOT EXIST "%PATH_TARGET%\" ECHO.&&ECHO. %XLR4%Target %TARGET_TYPE% doesn't exist.%#$%&&GOTO:IMAGEPROC_END +IF "%TARGET_TYPE%"=="WIM" IF EXIST "%IMAGE_FOLDER%\%WIM_TARGET%" ECHO.&&ECHO. %XLR4%Target %WIM_TARGET% exists. Try another name or delete the existing file.%#$%&&GOTO:IMAGEPROC_END +IF "%TARGET_TYPE%"=="VHDX" IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" ECHO.&&ECHO. File %#@%%VHDX_TARGET%%#$% already exists.&&ECHO. %XLR2%Note:%#$% Updating may cause errors. Try a new vhdx if having issues.&&ECHO.&&ECHO. Press (%##%X%#$%) to overwrite.&&ECHO.&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET +IF "%TARGET_TYPE%"=="VHDX" IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" IF NOT "%CONFIRM%"=="X" ECHO.&&ECHO. %##%Abort.%#$%&&GOTO:IMAGEPROC_END IF NOT DEFINED WIM_INDEX SET "WIM_INDEX=1" -IF NOT DEFINED WIM_XLVL SET "WIM_XLVL=FAST" IF NOT DEFINED VHDX_SIZE SET "VHDX_SIZE=25600" -IF NOT DEFINED WIM_DESC SET "WIM_DESC=DESC" IF "%SOURCE_TYPE%"=="WIM" IF "%TARGET_TYPE%"=="VHDX" CALL:WIM2VHDX IF "%SOURCE_TYPE%"=="VHDX" IF "%TARGET_TYPE%"=="WIM" CALL:VHDX2WIM -IF "%SOURCE_TYPE%"=="WIM" IF "%TARGET_TYPE%"=="PATH" CALL:WIM2PATH -IF "%SOURCE_TYPE%"=="PATH" IF "%TARGET_TYPE%"=="WIM" CALL:PATH2WIM -:IMAGEPROC_CLEANUP +IF "%SOURCE_TYPE%"=="WIM" IF "%TARGET_TYPE%"=="PATH" DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGE_FOLDER%\%WIM_SOURCE%" /INDEX:%WIM_INDEX% /APPLYDIR:"%PATH_TARGET%" +IF "%SOURCE_TYPE%"=="PATH" IF "%TARGET_TYPE%"=="WIM" DISM /ENGLISH /CAPTURE-IMAGE /CAPTUREDIR:"%PATH_SOURCE%" /IMAGEFILE:"%IMAGE_FOLDER%\%WIM_TARGET%" /COMPRESS:%WIM_XLVL% /NAME:"Index 1" +:IMAGEPROC_END ECHO.&&ECHO. %#@%IMAGE PROCESSING END:%#$% %DATE% %TIME%&&CALL:BOXB2&&IF NOT "%PROG_MODE%"=="COMMAND" CALL:PAUSED EXIT /B +:WIM2VHDX +ECHO.&&IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" SET "VDISK=%IMAGE_FOLDER%\%VHDX_TARGET%"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_ATTACH +IF NOT EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" SET "VDISK=%IMAGE_FOLDER%\%VHDX_TARGET%"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_CREATE +IF NOT EXIST "%VDISK_LTR%:\" ECHO.&&ECHO. %XLR4%Vdisk Error. If VHDX refuses mounting, try another.%#$% +IF EXIST "%VDISK_LTR%:\" DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGE_FOLDER%\%WIM_SOURCE%" /INDEX:%WIM_INDEX% /APPLYDIR:"%VDISK_LTR%:" +ECHO.&&CALL:VDISK_DETACH +EXIT /B +:VHDX2WIM +SET "NAME_TMP="&&FOR /F "TOKENS=1-2* DELIMS=:<> " %%a in ('DISM /ENGLISH /Get-ImageInfo /ImageFile:"%IMAGE_FOLDER%\%VHDX_SOURCE%" /INDEX:1 2^>NUL') DO (IF "%%a"=="Edition" SET "NAME_TMP=%%b") +IF NOT DEFINED NAME_TMP SET "NAME_TMP=Index 1" +ECHO.&&SET "VDISK=%IMAGE_FOLDER%\%VHDX_SOURCE%"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_ATTACH +IF NOT EXIST "%VDISK_LTR%:\" ECHO.&&ECHO. %XLR4%Vdisk Error. If VHDX refuses mounting, try another.%#$% +IF EXIST "%VDISK_LTR%:\" DISM /ENGLISH /CAPTURE-IMAGE /CAPTUREDIR:"%VDISK_LTR%:" /IMAGEFILE:"%IMAGE_FOLDER%\%WIM_TARGET%" /COMPRESS:%WIM_XLVL% /NAME:"%NAME_TMP%" +ECHO.&&CALL:VDISK_DETACH +EXIT /B :BOOT_IMPORT IF EXIST "%BOOT_FOLDER%\boot.sav" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. File boot.sav already exists. Press (%##%X%#$%) to overwrite.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET IF EXIST "%BOOT_FOLDER%\boot.sav" IF NOT "%CONFIRM%"=="X" EXIT /B @@ -1105,38 +983,15 @@ IF EXIST "%IMAGE_FOLDER%\%NEW_NAME%.wim" CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. IF EXIST "%IMAGE_FOLDER%\%NEW_NAME%.wim" IF NOT "%CONFIRM%"=="X" EXIT /B IF DEFINED NEW_NAME ECHO.Copying install.%WIM_EXT% to %#@%%NEW_NAME%.wim%#$%...&© /Y "%SOURCE_LOCATION%\install.%WIM_EXT%" "%IMAGE_FOLDER%\%NEW_NAME%.wim"&&SET "NEW_NAME=" EXIT /B -:WIM2VHDX -ECHO.&&IF EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" SET "VDISK=%IMAGE_FOLDER%\%VHDX_TARGET%"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_ATTACH -IF NOT EXIST "%IMAGE_FOLDER%\%VHDX_TARGET%" SET "VDISK=%IMAGE_FOLDER%\%VHDX_TARGET%"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_CREATE -IF NOT EXIST "%VDISK_LTR%:\" ECHO.&&ECHO. %XLR4%Vdisk Error. If VHDX refuses mounting, try another.%#$%&&ECHO.&&CALL:VDISK_DETACH&EXIT /B -SET "IMAGE_SRC=%IMAGE_FOLDER%\%WIM_SOURCE%"&&SET "APPLYDIR_MASTER=%VDISK_LTR%:" -DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGE_SRC%" /INDEX:%WIM_INDEX% /APPLYDIR:"%APPLYDIR_MASTER%" -ECHO.&&CALL:VDISK_DETACH -EXIT /B -:VHDX2WIM -ECHO.&&SET "VDISK=%IMAGE_FOLDER%\%VHDX_SOURCE%"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_ATTACH -IF NOT EXIST "%VDISK_LTR%:\" ECHO.&&ECHO. %XLR4%Vdisk Error. If VHDX refuses mounting, try another.%#$%&&ECHO.&&CALL:VDISK_DETACH&EXIT /B -SET "IMAGE_TGT=%IMAGE_FOLDER%\%WIM_TARGET%"&&SET "CAPTUREDIR_MASTER=%VDISK_LTR%:" -DISM /ENGLISH /CAPTURE-IMAGE /CAPTUREDIR:"%CAPTUREDIR_MASTER%" /IMAGEFILE:"%IMAGE_TGT%" /COMPRESS:%WIM_XLVL% /NAME:%WIM_DESC% -ECHO.&&CALL:VDISK_DETACH -EXIT /B -:WIM2PATH -SET "IMAGE_SRC=%IMAGE_FOLDER%\%WIM_SOURCE%"&&SET "APPLYDIR_MASTER=%PATH_TARGET%" -DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGE_SRC%" /INDEX:%WIM_INDEX% /APPLYDIR:"%APPLYDIR_MASTER%" -EXIT /B -:PATH2WIM -SET "IMAGE_TGT=%IMAGE_FOLDER%\%WIM_TARGET%"&&SET "CAPTUREDIR_MASTER=%PATH_SOURCE%" -DISM /ENGLISH /CAPTURE-IMAGE /CAPTUREDIR:"%CAPTUREDIR_MASTER%" /IMAGEFILE:"%IMAGE_TGT%" /COMPRESS:%WIM_XLVL% /NAME:%WIM_DESC% -EXIT /B -:IMAGEPROC_XLVL -IF "%WIM_XLVL%"=="FAST" SET "WIM_XLVL=MAX"&&EXIT /B -IF "%WIM_XLVL%"=="MAX" SET "WIM_XLVL=NONE"&&EXIT /B -IF "%WIM_XLVL%"=="NONE" SET "WIM_XLVL=FAST"&&EXIT /B -EXIT /B :IMAGEPROC_VSIZE -CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter new VHDX size in MB&&ECHO. Note: 25000 or greater is recommended&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_SET=VHDX_SIZE"&&CALL:PROMPT_SET -SET "CHECK=NUM"&&SET "CHECK_VAR=%VHDX_SIZE%"&&CALL:CHECK -IF DEFINED ERROR SET "VHDX_SIZE=25600" +CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter new VHDX size in GB&&ECHO. Note: 25GB or greater is recommended&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_SET=SELECTX"&&CALL:PROMPT_SET +SET "CHECK=NUM"&&SET "CHECK_VAR=%SELECTX%"&&CALL:CHECK +IF DEFINED ERROR EXIT /B +IF %SELECTX% LSS 1 SET "ERROR=1" +IF %SELECTX% GTR 9999 SET "ERROR=1" +IF NOT DEFINED ERROR IF %SELECTX% LSS 25 CALL:CONFIRM +IF NOT DEFINED ERROR IF %SELECTX% LSS 25 IF NOT "%CONFIRM%"=="X" SET "ERROR=1" +IF NOT DEFINED ERROR SET "VHDX_SIZE=%SELECTX%000" EXIT /B :IMAGEPROC_TARGET IF "%TARGET_TYPE%"=="PATH" CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Enter the target PATH &&ECHO.&&ECHO. %#@%AVAILABLE PATHs:%#$%&&ECHO.&&FOR %%G in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (IF EXIST "%%G:\" ECHO. ^( %##%%%G%#$% ^) Volume %%G:) @@ -1159,16 +1014,38 @@ IF NOT "%SOURCE_TYPE%"=="PATH" SET "MENUT0= Image Proc IF NOT "%SOURCE_TYPE%"=="PATH" IF "%SELECT%"=="." SET "FILE_TYPE=%SOURCE_TYPE%"&&CALL:BASIC_FILE&EXIT /B IF NOT "%SOURCE_TYPE%"=="PATH" CALL SET "%SOURCE_TYPE%_SOURCE=%$TRUMP%" EXIT /B +:WIM_INDEX_MENU +CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Processing&&ECHO.&&ECHO. %#@%AVAILABLE INDEXs:%#$%&&ECHO.&&SET "INDEX_TMP="&&SET "NAME_TMP="&&FOR /F "TOKENS=1-9 DELIMS=: " %%a in ('DISM /ENGLISH /Get-ImageInfo /ImageFile:"%IMAGE_FOLDER%\%WIM_SOURCE%" 2^>NUL') DO ( +IF "%%a"=="Index" CALL SET "INDEX_TMP=%%b" +IF "%%a"=="Name" CALL SET "NAME_TMP=%%b %%c %%d %%e %%f %%g %%h %%i"&&CALL:WIM_INDEX_LIST) +IF NOT DEFINED INDEX_TMP ECHO.%XLR2%ERROR%#$%&&SET "ERROR=1"&&EXIT /B +ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +IF NOT DEFINED SELECT SET "ERROR=1"&&EXIT /B +SET "WIM_INDEX=%SELECT%"&&CALL:WIM_INDEX_QUERY +IF "%WIM_DESC%"=="NULL" ECHO.&&ECHO. %XLR2%ERROR%#$%&&SET "ERROR=1" +EXIT /B +:WIM_INDEX_LIST +ECHO. ( %##%%INDEX_TMP%%#$% ) %NAME_TMP% +EXIT /B +:WIM_INDEX_QUERY +SET "WIM_DESC="&&FOR /F "TOKENS=1-5 DELIMS=<> " %%a in ('DISM /ENGLISH /Get-ImageInfo /ImageFile:"%IMAGE_FOLDER%\%WIM_SOURCE%" /Index:%WIM_INDEX% 2^>NUL') DO (IF "%%a"=="Edition" SET "WIM_DESC=%%c") +IF NOT DEFINED WIM_DESC SET "WIM_INDEX=1"&&SET "WIM_DESC=NULL" +EXIT /B :IMAGEPROC_SLOT IF "%SOURCE_TYPE%"=="WIM" IF "%TARGET_TYPE%"=="PATH" SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=VHDX"&&EXIT /B IF "%SOURCE_TYPE%"=="WIM" IF "%TARGET_TYPE%"=="VHDX" SET "SOURCE_TYPE=VHDX"&&SET "TARGET_TYPE=WIM"&&EXIT /B IF "%SOURCE_TYPE%"=="VHDX" IF "%TARGET_TYPE%"=="WIM" SET "SOURCE_TYPE=PATH"&&SET "TARGET_TYPE=WIM"&&EXIT /B IF "%SOURCE_TYPE%"=="PATH" IF "%TARGET_TYPE%"=="WIM" SET "SOURCE_TYPE=WIM"&&SET "TARGET_TYPE=PATH"&&EXIT /B EXIT /B +:IMAGEPROC_XLVL +IF "%WIM_XLVL%"=="FAST" SET "WIM_XLVL=MAX"&&EXIT /B +IF "%WIM_XLVL%"=="MAX" SET "WIM_XLVL=NONE"&&EXIT /B +IF "%WIM_XLVL%"=="NONE" SET "WIM_XLVL=FAST"&&EXIT /B +EXIT /B ::######################################################################### :IMAGE_MANAGER ::######################################################################### -@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Management&&ECHO. +@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Image Management&&ECHO. IF NOT DEFINED SAFE_EXCLUDE SET "SAFE_EXCLUDE=ENABLED" SET "MENUT0= %#@%AVAILABLE PKXs/LISTs:%#$%"&&SET "MENUT1= "&&SET "MENUB1= "&&SET "BLIST=CUST"&&SET "$FOLD0=%PACK_FOLDER%"&&SET "$FILT0=*.PKX"&&SET "$FOLD1=%LIST_FOLDER%"&&SET "$FILT1=*.LIST"&&CALL:FILE_LIST CALL:BOXB1&&CALL:PAD_LINE&&ECHO. [%#@%LIST%#$%] (%##%N%#$%)ew (%##%E%#$%)dit (%##%G%#$%)o^^! (%##%O%#$%)ptions&&CALL:PAD_LINE @@ -1341,7 +1218,7 @@ IF NOT EXIST "%EXTPACKAGE%" ECHO. %XLR4%%EXTPACKAGE% doesn't exist.%#$%&&EXIT /B SET "PACK_GOOD=The operation completed successfully"&&SET "PACK_BAD=The operation did not complete successfully" FOR %%G in ("%EXTPACKAGE%") DO SET "PACKFULL=%%~nG%%~xG"&&SET "PACKEXT=%%~xG" FOR %%G in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (CALL SET "PACKEXT=%%PACKEXT:%%G=%%G%%") -IF "%PACKEXT%"==".PKX" IF EXIST "%PROG_SOURCE%\ScratchPKX" ECHO. %XLR4%ERROR:%#$% %PACKFULL% - %PKX_NAME% is already in session. Abort.&&EXIT /B +IF "%PACKEXT%"==".PKX" IF EXIST "%PROG_SOURCE%\scratchPKX" ECHO. %XLR4%ERROR:%#$% %PACKFULL% - %PKX_NAME% is already in session. Abort.&&EXIT /B IF "%PACKEXT%"==".PKX" IF DEFINED PKX_SESSION ECHO. %XLR4%ERROR:%#$% %PACKFULL% - %PKX_NAME% is already in session. Abort.&&EXIT /B IF "%PACKEXT%"==".PKX" SET "PKX_SESSION=1"&&SET "PKX_PACK=%EXTPACKAGE%"&&GOTO:PKX_RUN FOR %%G in (APPXBUNDLE MSIXBUNDLE) DO (IF "%PACKEXT%"==".%%G" SET "PACKEXT=.APPX") @@ -1356,7 +1233,7 @@ IF "%PACKEXT%"==".MSU" SET "DISMSG="&&FOR /F "TOKENS=1 DELIMS=." %%1 in ('DISM / IF "%PACKEXT%"==".MSU" CALL ECHO. %XLR2%%PACK_BAD%.%#$%&&EXIT /B EXIT /B :PKX_RUN -SET "PKX_FOLDER=%PROG_SOURCE%\ScratchPKX"&&MD "%PROG_SOURCE%\ScratchPKX">NUL 2>&1 +SET "PKX_FOLDER=%PROG_SOURCE%\scratchPKX"&&MD "%PROG_SOURCE%\scratchPKX">NUL 2>&1 FOR %%G in ("%PKX_PACK%") DO (SET "PKX_NAME=%%~nG%%~xG") ECHO.Extracting %#@%%PKX_NAME%%#$%... SET "LAST_SESSION=%CURR_SESSION%"&&SET "LIST_FOLDER_Z=%LIST_FOLDER%"&&SET "PACK_FOLDER_Z=%PACK_FOLDER%"&&SET "CACHE_FOLDER_Z=%CACHE_FOLDER%"&&DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%PKX_PACK%" /INDEX:1 /APPLYDIR:"%PKX_FOLDER%">NUL 2>&1 @@ -1364,14 +1241,14 @@ IF EXIST "%PKX_FOLDER%\package.list" CD /D "%PKX_FOLDER%">NUL IF NOT EXIST "%PKX_FOLDER%\package.list" ECHO. %XLR2%ERROR:%#$% Package is either missing package.list or unable to extract. SET "CURR_SESSION=PACK"&&SET "LIST_FOLDER=%PKX_FOLDER%"&&SET "PACK_FOLDER=%PKX_FOLDER%"&&SET "CACHE_FOLDER=%PKX_FOLDER%"&&IF EXIST "%PKX_FOLDER%\package.list" SET "$RUN=%PKX_FOLDER%\package.list"&&CALL:LIST_RUN SET "CURR_SESSION=%LAST_SESSION%"&&SET "LIST_FOLDER=%LIST_FOLDER_Z%"&&SET "PACK_FOLDER=%PACK_FOLDER_Z%"&&SET "CACHE_FOLDER=%CACHE_FOLDER_Z%"&&CD /D "%PROG_FOLDER%">NUL -SET "LIST_FOLDER_Z="&&SET "PACK_FOLDER_Z="&&SET "CACHE_FOLDER_Z="&&SET "PKX_SESSION="&&SET "PKX_PACK="&&SET "PKX_FOLDER="&&SET "PKX_NAME="&&IF EXIST "%PROG_SOURCE%\ScratchPKX" CALL:PKX_DELETE +SET "LIST_FOLDER_Z="&&SET "PACK_FOLDER_Z="&&SET "CACHE_FOLDER_Z="&&SET "PKX_SESSION="&&SET "PKX_PACK="&&SET "PKX_FOLDER="&&SET "PKX_NAME="&&IF EXIST "%PROG_SOURCE%\scratchPKX" CALL:PKX_DELETE EXIT /B :PKX_DELETE DISM /cleanup-MountPoints>NUL 2>&1 -ATTRIB -R -S -H "%PROG_SOURCE%\ScratchPKX" /S /D /L>NUL 2>&1 -TAKEOWN /F "%PROG_SOURCE%\ScratchPKX" /R /D Y>NUL 2>&1 -ICACLS "%PROG_SOURCE%\ScratchPKX" /grant %USERNAME%:F /T >NUL 2>&1 -RD /S /Q "\\?\%PROG_SOURCE%\ScratchPKX">NUL 2>&1 +ATTRIB -R -S -H "%PROG_SOURCE%\scratchPKX" /S /D /L>NUL 2>&1 +TAKEOWN /F "%PROG_SOURCE%\scratchPKX" /R /D Y>NUL 2>&1 +ICACLS "%PROG_SOURCE%\scratchPKX" /grant %USERNAME%:F /T >NUL 2>&1 +RD /S /Q "\\?\%PROG_SOURCE%\scratchPKX">NUL 2>&1 EXIT /B :DRVR_ITEM IF NOT "%LIST_ACTN%"=="DELETE" IF NOT "%LIST_ACTN%"=="INSTALL" ECHO. %XLR4%ERROR:%#$% Driver list action is not INSTALL or DELETE.&&EXIT /B @@ -1554,20 +1431,6 @@ IF NOT EXIST "%WINTAR%\Setup\Scripts" MD "%WINTAR%\Setup\Scripts">NUL 2>&1 ECHO.%%SYSTEMDRIVE%%\$\windick.cmd -imagemgr -run -list %SCRO%.list -live>"%WINTAR%\Setup\Scripts\%SCRO%.cmd" ECHO.EXIT 0 >>"%WINTAR%\Setup\Scripts\%SCRO%.cmd" EXIT /B -:SCRATCH_CREATE -IF NOT DEFINED SCRATCHDIR SET "SCRATCHDIR=%PROG_SOURCE%\Scratch" -IF EXIST "%SCRATCHDIR%" SET "SCRATCHDIRX=%SCRATCHDIR%"&&CALL:SCRATCH_DELETE -IF DEFINED SCRATCHDIRX SET "SCRATCHDIR=%SCRATCHDIRX%" -IF NOT EXIST "%SCRATCHDIR%" MD "%SCRATCHDIR%">NUL 2>&1 -SET "SCRATCHDIRX=" -EXIT /B -:SCRATCH_DELETE -IF NOT DEFINED SCRATCHDIR SET "SCRATCHDIR=%PROG_SOURCE%\Scratch" -IF EXIST "%SCRATCHDIR%" DISM /cleanup-MountPoints>NUL 2>&1 -IF EXIST "%SCRATCHDIR%" ATTRIB -R -S -H "%SCRATCHDIR%" /S /D /L>NUL 2>&1 -IF EXIST "%SCRATCHDIR%" RD /S /Q "%SCRATCHDIR%">NUL 2>&1 -SET "SCRATCHDIR=" -EXIT /B ::######################################################################### :IMAGEMGR_BUILDER ::######################################################################### @@ -1638,6 +1501,28 @@ IF NOT DEFINED $PICK EXIT /B CALL:PAD_ADD&&SET "COMBINE_HEAD=EXEC-LIST"&&SET "$LST1=%$PICK%"&&CALL:LIST_COMBINE SET "NLIST_TMP="&&CALL:PAD_END&&CALL:PAUSED EXIT /B +:CUSTOM_MODE +@ECHO OFF&&IF NOT EXIST "%LIST_FOLDER%\menu.list" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU +SET "HEAD_EXT=LIST"&&SET "HEAD_CHECK=%LIST_FOLDER%\menu.list"&&CALL:HEAD_CHECK&TITLE +IF NOT "%$HEAD%"=="MULTI-LIST" ECHO.&&CALL:BOXT1&&ECHO.&&ECHO. %XLR4%ERROR:%#$% menu.list is not a multi list. Leaving custom menu.&&ECHO.&&CALL:BOXB1&&CALL:PAUSED&SET "MENU_MODE=NORMAL"&GOTO:MAIN_MENU +IF NOT DEFINED MENU_BANNER SET "MENU_BANNER= Press ( * ) to return to the main menu" +SET "MOUNT="&&CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:FREE_CALC&&SET "LIST_ACTN="&&SET "LIST_TIME="&&SET "LIST_ITEM=GROUP"&&CALL:PAD_LINE&&CALL:BOXT1&&SET "MENUT0=%#$%%MENU_BANNER%%#$%"&&SET "MENUT1= "&&SET "MENUB8= ( %##%Q%#$% ) Quit"&&SET "MENUB9= "&&SET "$LIST=%LIST_FOLDER%\menu.list"&&SET "ONLY1=GROUP"&&SET "NLIST=LIST"&&CALL:LIST_FILE&&CALL:BOXB1 +CALL:PAD_LINE&&CALL:MENU_SELECT +IF "%SELECT%"=="Q" GOTO:QUIT +IF "%SELECT%"=="*" SET "MENU_MODE=NORMAL"&&GOTO:MAIN_MENU +CALL SET "ITEM_SELECT=%%$ITEM%SELECT%%%" +IF NOT DEFINED ITEM_SELECT GOTO:CUSTOM_MODE +FOR /F "TOKENS=1-9 DELIMS=[]" %%1 IN ("%ITEM_SELECT%") DO (SET "GROUP_TARGET=%%2") +IF NOT DEFINED GROUP_TARGET GOTO:CUSTOM_MODE +CLS&&SET "LIST_ACTN="&&SET "LIST_TIME="&&SET "LIST_ITEM=GROUP"&&CALL:PAD_LINE&&CALL:BOXT1&&SET "MENUT0=%#$%%MENU_BANNER%%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "$LIST=%LIST_FOLDER%\menu.list"&&SET "ONLY1=GROUP"&&SET "ONLY2=%GROUP_TARGET%"&&SET "NLIST=LIST"&&CALL:LIST_FILE&&CALL:BOXB1&&CALL:PAD_LINE +IF DEFINED ERROR GOTO:MAIN_MENU +CALL:PAD_PREV&&CALL:MENU_SELECT +CALL SET "ITEM_SELECT=%%$ITEM%SELECT%%%" +IF NOT DEFINED ITEM_SELECT GOTO:CUSTOM_MODE +COPY /Y "%LIST_FOLDER%\menu.list" "$HZ">NUL&&SET "MLT_SESSION=1"&&ECHO.EXEC-LIST>"$LST2" +CALL SET "FULL_TARGET=%ITEM_SELECT%"&&CALL:GROUP_POPULATE +SET "$RUN=%PROG_FOLDER%\$LST2"&&SET "CURR_SESSION=MULTI"&&SET "LST_SESSION=1"&&SET "LIVE_APPLY=1"&&CALL:LIST_RUN +SET "CURR_SESSION="&&SET "MLT_SESSION="&&SET "LST_SESSION="&&SET "PKX_SESSION="&&GOTO:CUSTOM_MODE :GROUP_POPULATE IF NOT DEFINED FULL_TARGET EXIT /B SET "SUB_TARGET="&&FOR /F "TOKENS=1-9 DELIMS=[]" %%1 in ("%FULL_TARGET%") DO (SET "SUB_TARGET=%%3") @@ -1987,7 +1872,7 @@ EXIT /B ::######################################################################### :PACKAGE_CREATOR ::######################################################################### -@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Package Creator&&ECHO.&&IF NOT DEFINED PROJ_XLVL SET "PROJ_XLVL=FAST" +@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Package Creator&&ECHO.&&IF NOT DEFINED PROJ_XLVL SET "PROJ_XLVL=FAST" SET "MENUT0= %#@%PACKAGE CONTENTS:%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "$FOLD0=%MAKER_FOLDER%"&&SET "$FILT0=*.*"&&SET "BLIST=CUST"&&CALL:FILE_LIST&&CALL:BOXB1&&CALL:PAD_LINE IF EXIST "%MAKER_FOLDER%\*" ECHO. (%##%X%#$%)Project%#@%%PROJ_SLOT%%#$% (%##%N%#$%)ew (%##%C%#$%)reate (%##%R%#$%)estore (%##%E%#$%)dit (%##%D%#$%)riverExport (%##%Z%#$%)Lvl %#@%%PROJ_XLVL%%#$%&&CALL:PAD_LINE IF NOT EXIST "%MAKER_FOLDER%\*" ECHO. (%##%X%#$%)Project%#@%%PROJ_SLOT%%#$% (%##%N%#$%)ew (%##%R%#$%)estore (%##%D%#$%)riverExport &&CALL:PAD_LINE @@ -2061,7 +1946,7 @@ EXIT /B ::######################################################################### :FILE_MANAGER ::######################################################################### -@ECHO OFF&&CLS&&CALL:TITLE_X&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. File Management&&ECHO. +@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. File Management&&ECHO. IF NOT DEFINED FMGR_DUAL SET "FMGR_DUAL=DISABLED" IF NOT DEFINED FMGR_SOURCE SET "FMGR_SOURCE=%PROG_SOURCE%"&&SET "FMGR_TARGET=%PROG_SOURCE%" IF NOT EXIST "%FMGR_SOURCE%\*" SET "FMGR_SOURCE=%PROG_SOURCE%"&&SET "FMGR_TARGET=%PROG_SOURCE%" @@ -2168,15 +2053,72 @@ IF NOT EXIST "%FMGR_TARGET%" EXIT /B SET "FMGR_SOURCE=%FMGR_TARGET%"&&SET "FMGR_TARGET=%FMGR_SOURCE%" EXIT /B ::######################################################################### +:BASIC_FILE +::######################################################################### +IF DEFINED FILE_OPER GOTO:BASIC_FILETYPE +CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. File Operation&&ECHO.&&ECHO. (%##%1%#$%) Rename&&ECHO. (%##%2%#$%) Delete&&ECHO. (%##%3%#$%) Copy&&IF "%FOLDER_MODE%"=="ISOLATED" FOR %%G in (VHDX MAIN IMAGE) DO (IF "%FILE_TYPE%"=="%%G" ECHO. ^(%##%4%#$%^) Move) +ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_SET=FILE_PROMPT"&&CALL:PROMPT_SET +IF "%FILE_PROMPT%"=="1" SET "FILE_OPER=Rename" +IF "%FILE_PROMPT%"=="2" SET "FILE_OPER=Delete" +IF "%FILE_PROMPT%"=="3" SET "FILE_OPER=Copy" +IF "%FILE_PROMPT%"=="4" IF "%FOLDER_MODE%"=="ISOLATED" FOR %%G in (VHDX MAIN IMAGE) DO (IF "%FILE_TYPE%"=="%%G" SET "FILE_OPER=MoveVHDX") +IF NOT DEFINED FILE_OPER GOTO:BASIC_ERROR +:BASIC_FILETYPE +IF "%FILE_OPER%"=="MoveVHDX" IF "%FOLDER_MODE%"=="ISOLATED" CALL:VHDX_MOVE&GOTO:BASIC_ERROR +IF DEFINED FILE_SKIP GOTO:BASIC_FILEOPER +:BASIC_FILEPICK +FOR %%X in (WIM VHDX ISO LIST BASE CAB MSU PKX APPX APPXBUNDLE MSIXBUNDLE) DO (IF "%%X"=="%FILE_TYPE%" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE %%Xs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=%%X"&&CALL:FILE_PICK) +IF "%FILE_TYPE%"=="WALL" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE JPGs/PNGs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%CACHE_FOLDER%"&&SET "$FILT0=*.JPG *.PNG"&&CALL:FILE_PICK +IF "%FILE_TYPE%"=="MAIN" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_PICK +IF "%FILE_TYPE%"=="IMAGE" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE WIMs/VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%IMAGE_FOLDER%"&&SET "$FILT0=*.WIM *.VHDX"&&CALL:FILE_PICK +IF "%FILE_TYPE%"=="LISTS" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE LISTs/BASEs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%LIST_FOLDER%"&&SET "$FILT0=*.LIST *.BASE"&&CALL:FILE_PICK +IF "%FILE_TYPE%"=="PACK" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE PACKAGEs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PACK_FOLDER%"&&SET "$FILT0=*.PKX *.CAB *.MSU *.APPX *.APPXBUNDLE *.MSIXBUNDLE"&&CALL:FILE_PICK +IF "%FILE_TYPE%"=="PKXLIST" SET "MENUT0= File %FILE_OPER%"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE PKXs/LISTs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PACK_FOLDER%"&&SET "$FILT0=*.PKX"&&SET "$FOLD1=%LIST_FOLDER%"&&SET "$FILT1=*.LIST"&&CALL:FILE_PICK&SET "ERROR=" +IF "%FILE_TYPE%"=="PKXLIST" SET "$PICK_EXT="&&IF DEFINED $TRUMP FOR %%G in ("%$TRUMP%") DO (SET "CAPS_SET=$PICK_EXT"&&SET "CAPS_VAR=%%~xG"&&CALL:CAPS_SET) +IF "%FILE_TYPE%"=="PKXLIST" IF "%$PICK_EXT%"==".PKX" SET "$PICK=%PACK_FOLDER%\%$TRUMP%"&&SET "$PICK_PATH=%PACK_FOLDER%\" +IF "%FILE_TYPE%"=="PKXLIST" IF "%$PICK_EXT%"==".LIST" SET "$PICK=%LIST_FOLDER%\%$TRUMP%"&&SET "$PICK_PATH=%LIST_FOLDER%\" +IF NOT DEFINED $PICK GOTO:BASIC_ERROR +:BASIC_FILEOPER +IF "%FILE_OPER%"=="Delete" CALL:CONFIRM +IF "%FILE_OPER%"=="Delete" IF "%CONFIRM%"=="X" DEL /Q /F "%$PICK%">NUL +IF "%FILE_OPER%"=="Delete" GOTO:BASIC_ERROR +CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter new name of %$PICK_EXT%&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&SET "PROMPT_SET=FILE_PROMPT"&&SET "PROMPT_ANY=1"&&CALL:PROMPT_SET +IF NOT DEFINED FILE_PROMPT GOTO:BASIC_ERROR +IF EXIST "%$PICK_PATH%\%FILE_PROMPT%%$PICK_EXT%" GOTO:BASIC_ERROR +SET "CASE=LOWER"&&SET "CAPS_SET=$PICK_EXT"&&SET "CAPS_VAR=%$PICK_EXT%"&&CALL:CAPS_SET +IF "%FILE_OPER%"=="Rename" REN "%$PICK%" "%FILE_PROMPT%%$PICK_EXT%">NUL 2>&1 +IF "%FILE_OPER%"=="Copy" ECHO.Copying %FILE_PROMPT%%$PICK_EXT%...&© /Y "%$PICK%" "%$PICK_PATH%%FILE_PROMPT%%$PICK_EXT%">NUL 2>&1 +:BASIC_ERROR +SET "FILE_OPER="&&SET "FILE_TYPE="&&SET "FILE_NAME="&&SET "FILE_SKIP="&&SET "$PICK=" +EXIT /B +:VHDX_MOVE +IF NOT "%FOLDER_MODE%"=="ISOLATED" EXIT /B +CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Move VHDX between folders&&ECHO.&&SET "MENUT0= %#@%IMAGE FOLDER VHDXs:%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "BLIST=VHDX"&&CALL:FILE_LIST +ECHO. ( %##%-%#$% / %##%+%#$% )&&ECHO.&&SET "MENUT0= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "BLIST=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_LIST&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +IF NOT DEFINED SELECT EXIT /B +IF "%SELECT%"=="-" CALL:MOVE2IMAGE +IF "%SELECT%"=="+" CALL:MOVE2MAIN +GOTO:VHDX_MOVE +:MOVE2IMAGE +SET "MENUT0= Move to image folder"&&SET "MENUT1= "&&SET "MENUT2= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_PICK +IF DEFINED $PICK IF EXIST "%IMAGE_FOLDER%\%$TRUMP%" CALL:PAD_LINE&&ECHO. File already exists in IMAGE folder. Press (%##%X%#$%) to overwrite %#@%%$TRUMP%%#$%.&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET +IF DEFINED $PICK IF EXIST "%IMAGE_FOLDER%\%$TRUMP%" IF NOT "%CONFIRM%"=="X" EXIT /B +IF DEFINED $PICK MOVE /Y "%$PICK%" "%IMAGE_FOLDER%\">NUL +EXIT /B +:MOVE2MAIN +SET "MENUT0= Move to main folder"&&SET "MENUT1= "&&SET "MENUT2= %#@%IMAGE FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUB0= "&&SET "PICK=VHDX"&&CALL:FILE_PICK +IF DEFINED $PICK IF EXIST "%PROG_SOURCE%\%$TRUMP%" CALL:PAD_LINE&&ECHO. File already exists in MAIN folder. Press (%##%X%#$%) to overwrite %#@%%$TRUMP%%#$%.&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL SET "PROMPT_SET=CONFIRM"&&CALL:PROMPT_SET +IF DEFINED $PICK IF EXIST "%PROG_SOURCE%\%$TRUMP%" IF NOT "%CONFIRM%"=="X" EXIT /B +IF DEFINED $PICK MOVE /Y "%$PICK%" "%PROG_SOURCE%\">NUL +EXIT /B +::######################################################################### :DISK_MANAGER ::######################################################################### -@ECHO OFF&&CLS&&SET "DISK_LETTER="&&SET "DISK_MSG="&&SET "ERROR="&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Disk Management&&CALL:DISK_LIST_BASIC&&CALL:BOXB1&&CALL:PAD_LINE -IF NOT DEFINED HOST_HIDE SET "HOST_HIDE=DISABLED" -IF NOT DEFINED HOST_HIDE SET "HOST_HIDE=DISABLED" +@ECHO OFF&&CLS&&SET "DISK_LETTER="&&SET "DISK_MSG="&&SET "ERROR="&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Disk Management&&CALL:DISK_LIST_BASIC&&CALL:BOXB1&&CALL:PAD_LINE IF NOT DEFINED NEXT_BOOT SET "NEXT_BOOT=QUERY" ECHO. [%#@%DISK%#$%] (%##%B%#$%)oot Creator (%##%I%#$%)nspect (%##%E%#$%)rase (%##%*%#$%)NextBoot %#@%%NEXT_BOOT%%#$% (%##%O%#$%)ptions&&CALL:PAD_LINE IF NOT "%PROG_MODE%"=="RAMDISK" ECHO. [%#@%PART%#$%] (%##%C%#$%)reate (%##%D%#$%)elete (%##%F%#$%)ormat (%##%M%#$%)ount (%##%U%#$%)nmount&&CALL:PAD_LINE -IF "%PROG_MODE%"=="RAMDISK" ECHO. [%#@%PART%#$%] (%##%C%#$%)reate (%##%D%#$%)elete (%##%F%#$%)ormat (%##%M%#$%)ount (%##%U%#$%)nmount (%##%H%#$%)ide Host %#@%%HOST_HIDE%%#$%&&CALL:PAD_LINE +IF "%PROG_MODE%"=="RAMDISK" ECHO. [%#@%PART%#$%] (%##%C%#$%)reate (%##%D%#$%)elete (%##%F%#$%)ormat (%##%M%#$%)ount (%##%U%#$%)nmount (%##%H%#$%)ost Hide %#@%%HOST_HIDE%%#$%&&CALL:PAD_LINE IF DEFINED ADV_DISK ECHO. [%#@%IMAGE%#$%](%##%N%#$%)ew VHDX (%##%V%#$%)HDX Mount (%##%X%#$%)ISO Mount (%##%U%#$%)nmount&&CALL:PAD_LINE CALL:PAD_PREV&&CALL:MENU_SELECT IF NOT DEFINED SELECT GOTO:MAIN_MENU @@ -2435,30 +2377,32 @@ IF NOT "%UID_XNT%"=="36" SET "GET_DISK_ID=00000000-0000-0000-0000-000000000000" SET "UID_X=%GET_DISK_ID%"&&SET "DISK_X=%DISK_NUMBER%"&&CALL:DISK_UID EXIT /B :HOST_HIDE -CALL:PAD_LINE&&ECHO.Hiding VHDX host partition...&&CALL:PAD_LINE&&SET /P DISK_TARGET=<"%PROG_FOLDER%\DISK_TARGET"&&CALL:DISK_DETECT>NUL 2>&1 +ECHO. Hiding the vhdx host partition...&&SET /P DISK_TARGET=<"%PROG_FOLDER%\HOST_TARGET"&&CALL:DISK_DETECT>NUL 2>&1 IF NOT DEFINED DISK_DETECT EXIT /B SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=2"&&SET "LETT_X=Z"&&CALL:PART_REMOVE&&SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=2"&&CALL:PART_4000 EXIT /B :HOST_AUTO -SET "HOST_ERROR="&&IF NOT DEFINED ARBIT_FLAG CLS&&ECHO.Querying disks... +SET "PROG_NAME=windick"&&SET "HOST_ERROR="&&IF NOT DEFINED ARBIT_FLAG CLS&&ECHO.Querying disks... IF EXIST "Z:\" (ECHO.select volume Z&&ECHO.remove letter=Z noerr&&ECHO.exit)>"$DSK"&&DISKPART /s "$DSK">NUL 2>&1 -SET /P DISK_TARGET=<"%PROG_FOLDER%\DISK_TARGET" -SET "HOST_TARGET=%DISK_TARGET%" +IF EXIST "%PROG_FOLDER%\HOST_FOLDER" SET /P HOST_FOLDERX=<"%PROG_FOLDER%\HOST_FOLDER" +IF NOT DEFINED HOST_FOLDERX SET "HOST_FOLDERX=$" +SET /P HOST_TARGET=<"%PROG_FOLDER%\HOST_TARGET" +SET "DISK_TARGET=%HOST_TARGET%" IF DEFINED ARBIT_FLAG CALL:DISK_DETECT>NUL 2>&1 IF NOT DEFINED ARBIT_FLAG SET "QUERY_X=1"&&CALL:DISK_DETECT SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=2"&&CALL:PART_8000&&SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=2"&&SET "LETT_X=Z"&&CALL:PART_ASSIGN -IF EXIST "Z:\" IF NOT EXIST "Z:\$" MD "Z:\$">NUL 2>&1 -IF EXIST "Z:\$" IF NOT EXIST "Z:\$\windick.cmd" COPY "X:\$\windick.cmd" "Z:\$">NUL 2>&1 -IF EXIST "Z:\$\settings.ini" COPY /Y "Z:\$\settings.ini" "%PROG_FOLDER%">NUL 2>&1 -IF NOT EXIST "Z:\$" IF NOT DEFINED ARBIT_FLAG SET "ARBIT_FLAG=1"&&GOTO:HOST_AUTO -SET "ARBIT_FLAG="&&IF EXIST "Z:\$" SET "PROG_SOURCE=Z:\$"&&SET "HOST_NUMBER=%DISK_DETECT%" +IF EXIST "Z:\" IF NOT EXIST "Z:\%HOST_FOLDERX%" MD "Z:\%HOST_FOLDERX%">NUL 2>&1 +IF EXIST "Z:\%HOST_FOLDERX%" IF NOT EXIST "Z:\%HOST_FOLDERX%\%PROG_NAME%.cmd" COPY "X:\%HOST_FOLDERX%\%PROG_NAME%.cmd" "Z:\%HOST_FOLDERX%">NUL 2>&1 +IF EXIST "Z:\%HOST_FOLDERX%\settings.ini" COPY /Y "Z:\%HOST_FOLDERX%\settings.ini" "%PROG_FOLDER%">NUL 2>&1 +IF NOT EXIST "Z:\%HOST_FOLDERX%" IF NOT DEFINED ARBIT_FLAG SET "ARBIT_FLAG=1"&&GOTO:HOST_AUTO +SET "ARBIT_FLAG="&&IF EXIST "Z:\%HOST_FOLDERX%" SET "PROG_SOURCE=Z:\%HOST_FOLDERX%"&&SET "HOST_NUMBER=%DISK_DETECT%" IF NOT DEFINED DISK_DETECT SET "HOST_ERROR=1"&&SET "DISK_TARGET=" EXIT /B :EFI_MOUNT IF NOT DEFINED DISK_TARGET SET "EFI_LETTER="&&EXIT /B SET "$GET=EFI_LETTER"&&CALL:LETTER_ANY -SET /P DISK_TARGET=<"%PROG_FOLDER%\DISK_TARGET" -SET "HOST_TARGET=%DISK_TARGET%"&&CALL:DISK_DETECT>NUL 2>&1 +SET /P HOST_TARGET=<"%PROG_FOLDER%\HOST_TARGET" +SET "DISK_TARGET=%HOST_TARGET%"&&CALL:DISK_DETECT>NUL 2>&1 IF NOT DEFINED DISK_DETECT SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% EFI target disk could not be found.&&SET "EFI_LETTER="&&EXIT /B SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=1"&&CALL:PART_BAS SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=1"&&SET "LETT_X=%EFI_LETTER%"&&CALL:PART_ASSIGN @@ -2510,7 +2454,7 @@ IF "%%1"=="Type" ECHO. %#@%Type%#$% = %%2 IF "%%1 %%2"=="Disk ID" ECHO. %#@%UID%#$% = %%3 IF "%%1 %%2 %%3"=="Pagefile Disk Yes" ECHO. %XLR2% Active Pagefile%#$% IF "%%1"=="Partition" IF NOT "%%2"=="###" SET "PARTX=%%2"&&SET "SIZEX=%%4 %%5"&&(ECHO.select disk %%b&&ECHO.select partition %%2&&ECHO.detail partition&&ECHO.Exit)>"$DSK"&&SET "LTRX="&&FOR /F "TOKENS=1-9 SKIP=6 DELIMS=* " %%A in ('DISKPART /s "$DSK"') DO (IF "%%A"=="Volume" IF NOT "%%B"=="###" SET "LTRX=%%C"&&CALL:DISK_CHECK) -IF NOT DEFINED LTRX ECHO. %#@%Part %%2%#$% Vol * %%4 %%5)) +IF NOT DEFINED LTRX IF NOT "%%2"=="DiskPart..." ECHO. %#@%Part %%2%#$% Vol * %%4 %%5)) IF DEFINED DISK_GET CALL:DISK_DETECT>NUL 2>&1 ECHO.&&CALL:BOXB1 FOR %%a in (PASS LTRX PARTX SIZEX QUERY_MSG DISK_GET) DO (SET "%%a=") @@ -2528,6 +2472,7 @@ FOR %%$ in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (IF "%%1"==" ECHO.&&DEL /Q /F "$DSK*">NUL 2>&1 EXIT /B :DISK_DETECT +FOR /F "TOKENS=1 DELIMS=:" %%G in ("%SystemDrive%") DO (SET "SYS_VOLUME=%%G") FOR /F "TOKENS=1 DELIMS=:" %%G in ("%PROG_SOURCE%") DO (SET "PROG_VOLUME=%%G") SET "DISK_DETECT="&&FOR %%a in (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) DO (IF DEFINED DISK_%%a SET "DISK_%%a="&&SET "DISKID_%%a=") (ECHO.LIST DISK&&ECHO.Exit)>"$DSK"&&FOR /F "TOKENS=1,2,4 SKIP=8 DELIMS= " %%a in ('DISKPART /s "$DSK"') DO (IF "%%a"=="Disk" IF NOT "%%b"=="###" SET "DISK_%%b="&&(ECHO.select disk %%b&&ECHO.detail disk&&ECHO.list partition&&ECHO.Exit)>"$DSK"&&FOR /F "TOKENS=1-9 SKIP=6 DELIMS={}: " %%1 in ('DISKPART /s "$DSK"') DO ( @@ -2536,14 +2481,16 @@ IF "%%1 %%2"=="Disk ID" SET "DISKID_%%b=%%3"&&IF "%%3"=="%DISK_TARGET%" SET "DIS IF "%%1 %%2"=="Disk ID" IF DEFINED QUERY_X ECHO. Getting info for disk uid %##%%%3%#$%... IF "%%1 %%2 %%3"=="Pagefile Disk Yes" SET "DISK_%%b=" IF "%%2 %%3 %%4"=="File Backed Virtual" SET "DISK_%%b=VDISK" +IF "%%1 %%3"=="Volume %SYS_VOLUME%" SET "DISK_%%b=" IF "%%1 %%3"=="Volume %PROG_VOLUME%" SET "DISK_%%b=" IF "%%1 %%3"=="Volume Z" IF "%PROG_MODE%"=="RAMDISK" SET "HOST_VOLUME=%%2")) -SET "QUERY_X="&&DEL /Q /F "$DSK*">NUL 2>&1 +IF DEFINED QUERY_X SET "QUERY_X="&&CLS +DEL /Q /F "$DSK*">NUL 2>&1 EXIT /B ::######################################################################### :BOOT_CREATOR ::######################################################################### -CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Boot Creator&&ECHO. +CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Boot Creator&&ECHO. IF NOT DEFINED HOST_SIZE (SET "EMBEE=") ELSE (SET "EMBEE=MB") SET "MENUT0= %#@%AVAILABLE VHDXs:%#$%"&&SET "MENUT1= "&&SET "MENUB0= "&&SET "BLIST=VHDX"&&CALL:FILE_LIST&&CALL:BOXB1&&CALL:PAD_LINE&&ECHO. (%##%O%#$%)ptions (%##%G%#$%)o^^! (%##%V%#$%)HDX %#@%%VHDX_SLOTX%%#$%&&CALL:PAD_LINE IF DEFINED ADV_BOOT ECHO. [%#@%OPTIONS%#$%] (%##%A%#$%)dd File (%##%E%#$%)xport EFI (%##%H%#$%)ost Size %#@%%HOST_SIZE%%EMBEE%%#$% (%##%W%#$%)allpaper %#@%%PE_WALLPAPER%%#$%&&CALL:PAD_LINE @@ -2559,12 +2506,6 @@ IF "%SELECT%"=="A" CALL:ADDFILE_MENU IF "%SELECT%"=="G" CALL:BOOT_CREATOR_PROMPT IF "%SELECT%"=="W" CALL:PE_WALLPAPER GOTO:BOOT_CREATOR -:PE_WALLPAPER -CLS&&SET "MENUT0= Recovery Wallpaper"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE JPGs/PNGs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%CACHE_FOLDER%"&&SET "$FILT0=*.JPG *.PNG"&&CALL:FILE_PICK -IF "%SELECT%"=="." SET "FILE_TYPE=WALL"&&CALL:BASIC_FILE&EXIT /B -IF DEFINED $PICK SET "PE_WALLPAPER=%$TRUMP%" -IF NOT DEFINED $PICK SET "PE_WALLPAPER=SELECT" -EXIT /B :ADDFILE_MENU CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Add File&&ECHO. FOR %%G in (0 1 2 3 4 5 6 7 8 9) DO (CALL ECHO. File ^(%##%%%G%#$%^) %#@%%%ADDFILE_%%G%%%#$%) @@ -2590,36 +2531,6 @@ CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Creates 3 partition disk, remaining spa SET "CHECK_VAR=%HOST_SIZE%"&&SET "CHECK=NUM"&&CALL:CHECK IF DEFINED ERROR SET "HOST_SIZE=" EXIT /B -:VHDX_CHECK -CLS&&IF "%$VHDX%"=="X" SET "MENUT0= Boot Creator"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=VHDX"&&CALL:FILE_PICK -IF "%$VHDX%"=="X" IF "%SELECT%"=="." SET "FILE_TYPE=VHDX"&&CALL:BASIC_FILE&SET "ERROR=1"&EXIT /B -IF NOT "%$VHDX%"=="X" SET "MENUT0= Boot Menu Editor"&&SET "MENUT1= "&&SET "MENUT2= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_PICK -IF NOT "%$VHDX%"=="X" IF "%SELECT%"=="." SET "FILE_TYPE=MAIN"&&CALL:BASIC_FILE&SET "ERROR=1"&EXIT /B -IF NOT DEFINED $PICK SET "VHDX_SLOT%$VHDX%="&&SET "$VHDX="&&EXIT /B -SET "CHAR_STR=%$TRUMP%"&&SET "CHAR_CHK= "&&CALL:CHAR_CHK -IF DEFINED CHAR_FLG CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Remove the space from the VHDX name, then try again.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "VHDX_SLOT%$VHDX%="&&CALL:PAUSED -IF NOT DEFINED CHAR_FLG SET "VHDX_SLOT%$VHDX%=%$TRUMP%" -SET "$VHDX=" -EXIT /B -:APPLY_IMAGE -IF NOT DEFINED IMAGEFILE EXIT /B -IF NOT DEFINED APPLYDIR SET "APPLYDIR=%VDISK_LTR%:" -IF NOT DEFINED IMAGEINDEX SET "IMAGEINDEX=1" -DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGEFILE%" /INDEX:%IMAGEINDEX% /APPLYDIR:"%APPLYDIR%"&ECHO.&SET "IMAGEFILE="&SET "IMAGEINDEX=" -EXIT /B -:CAPTURE_IMAGE -IF NOT DEFINED IMAGEFILE EXIT /B -IF NOT DEFINED CAPTUREDIR SET "CAPTUREDIR=%VDISK_LTR%:" -DISM /ENGLISH /CAPTURE-IMAGE /IMAGEFILE:"%IMAGEFILE%" /CAPTUREDIR:"%CAPTUREDIR%" /NAME:NAME /CheckIntegrity /Verify /Bootable&ECHO.&SET "IMAGEFILE=" -EXIT /B -:FIND_INDEX -IF NOT DEFINED IMAGEFILE EXIT /B -SET "IMAGEINDEX="&&CALL SET /A "INDEX_TMP+=1" -FOR /F "TOKENS=5 SKIP=5 DELIMS=<> " %%a in ('DISM /ENGLISH /GET-IMAGEINFO /IMAGEFILE:"%IMAGEFILE%" /INDEX:%INDEX_TMP% 2^>NUL') DO (IF "%%a"=="%INDEX_WORD%" SET "IMAGEINDEX=%INDEX_TMP%"&&GOTO:FIND_INDEX_BREAK) -IF NOT DEFINED IMAGEINDEX IF NOT "%INDEX_TMP%" EQU "20" GOTO:FIND_INDEX -:FIND_INDEX_BREAK -SET "IMAGEFILE="&&SET "INDEX_TMP="&&SET "INDEX_WORD=" -EXIT /B :EFI_FETCH CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. EFI boot files will be extracted from the boot media.&&ECHO.&&CALL:BOXB1&&CALL:CONFIRM IF NOT "%CONFIRM%"=="X" EXIT /B @@ -2673,7 +2584,7 @@ SET "RETRY_PART1="&&SET "RETRY_PART2="&&SET "RETRY_PART3="&&SET "EFI="&&ECHO.&&S ::######################################################################### :BOOT_CREATOR_START ::######################################################################### -IF NOT "%PROG_MODE%"=="COMMAND" CLS +SET "PROG_NAME=windick"&&IF NOT "%PROG_MODE%"=="COMMAND" CLS CALL:BOXT2&&ECHO. %#@%BOOT CREATOR START:%#$% %DATE% %TIME%&&ECHO. SET "DISK_MSG="&&DISM /cleanup-MountPoints>NUL 2>&1 SET "CHAR_STR=%VHDX_SLOTX%"&&SET "CHAR_CHK= "&&CALL:CHAR_CHK @@ -2689,17 +2600,19 @@ SET "PRI_LETTER="&&FOR %%G in (Z Y X W V U T S R Q P O N M L K J I H G F E D) DO SET "TST_LETTER="&&FOR %%G in (Z Y X W V U T S R Q P O N M L K J I H G F E D) DO (IF NOT EXIST "%%G:\" IF NOT "%%G"=="%EFI_LETTER%" IF NOT "%%G"=="%PRI_LETTER%" SET "TST_LETTER=%%G") ECHO. Creating partitions on disk uid %DISK_TARGET%...&&CALL:PART_CREATE IF DEFINED ERROR GOTO:BOOT_CLEANUP -ECHO. Mounting temporary vdisk...&&MD "%PRI_LETTER%:\$\Scratch">NUL 2>&1 -SET "VDISK=%PRI_LETTER%:\$\Scratch\scratch.vhdx"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_CREATE>NUL 2>&1 -IF EXIST "%BOOT_FOLDER%\BOOT.SAV" ECHO. Extracting boot-media. Using boot.sav located in folder...&© /Y "%BOOT_FOLDER%\boot.sav" "%PRI_LETTER%:\$\boot.wim">NUL 2>&1 -SET "IMAGEFILE=%PRI_LETTER%:\$\boot.wim"&&SET "INDEX_WORD=Setup"&&CALL:FIND_INDEX&&CALL:TITLECARD -SET "IMAGEFILE=%PRI_LETTER%:\$\boot.wim"&&SET "APPLYDIR=%VDISK_LTR%:"&&IF NOT DEFINED IMAGEINDEX SET "IMAGEINDEX=1" +ECHO. Mounting temporary vdisk...&&MD "%PRI_LETTER%:\%HOST_FOLDER%\scratch">NUL 2>&1 +FOR %%a in (%PRI_LETTER%: %PRI_LETTER%:\%HOST_FOLDER%) DO (ICACLS "%%a" /deny everyone:^(DE,WA,WDAC^)>NUL 2>&1) +SET "VDISK=%PRI_LETTER%:\%HOST_FOLDER%\scratch\scratch.vhdx"&&SET "VDISK_LTR=ANY"&&CALL:VDISK_CREATE>NUL 2>&1 +IF EXIST "%BOOT_FOLDER%\BOOT.SAV" ECHO. Extracting boot-media. Using boot.sav located in folder...&© /Y "%BOOT_FOLDER%\boot.sav" "%PRI_LETTER%:\%HOST_FOLDER%\boot.wim">NUL 2>&1 +SET "IMAGEFILE=%PRI_LETTER%:\%HOST_FOLDER%\boot.wim"&&SET "INDEX_WORD=Setup"&&CALL:FIND_INDEX +SET "IMAGEFILE=%PRI_LETTER%:\%HOST_FOLDER%\boot.wim"&&SET "APPLYDIR=%VDISK_LTR%:"&&IF NOT DEFINED IMAGEINDEX SET "IMAGEINDEX=1" DISM /ENGLISH /APPLY-IMAGE /IMAGEFILE:"%IMAGEFILE%" /INDEX:%IMAGEINDEX% /APPLYDIR:"%APPLYDIR%"&ECHO. -MOVE /Y "%PRI_LETTER%:\$\boot.wim" "%PRI_LETTER%:\$\boot.sav">NUL 2>&1 +MOVE /Y "%PRI_LETTER%:\%HOST_FOLDER%\boot.wim" "%PRI_LETTER%:\%HOST_FOLDER%\boot.sav">NUL 2>&1 IF NOT EXIST "%VDISK_LTR%:\Windows" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% Mount failure, Index %IMAGEINDEX% &&GOTO:BOOT_CLEANUP MD "%APPLYDIR%\$">NUL 2>&1 -ECHO.%DISK_TARGET%>"%APPLYDIR%\$\DISK_TARGET" -COPY /Y "%PROG_SOURCE%\windick.cmd" "%APPLYDIR%\$">NUL© /Y "%PROG_SOURCE%\windick.cmd" "%PRI_LETTER%:\$">NUL© /Y "%PROG_SOURCE%\settings.ini" "%PRI_LETTER%:\$">NUL +ECHO.%DISK_TARGET%>"%APPLYDIR%\$\HOST_TARGET" +ECHO.%HOST_FOLDER%>"%APPLYDIR%\$\HOST_FOLDER" +COPY /Y "%PROG_SOURCE%\%PROG_NAME%.cmd" "%APPLYDIR%\$">NUL© /Y "%PROG_SOURCE%\%PROG_NAME%.cmd" "%PRI_LETTER%:\%HOST_FOLDER%">NUL© /Y "%PROG_SOURCE%\settings.ini" "%PRI_LETTER%:\%HOST_FOLDER%">NUL FOR %%a in (Boot EFI\Boot EFI\Microsoft\Boot) DO (MD %EFI_LETTER%:\%%a>NUL 2>&1) IF EXIST "%BOOT_FOLDER%\boot.sdi" ECHO. Using boot.sdi located in folder, for efi image boot support.&© /Y "%BOOT_FOLDER%\boot.sdi" "%EFI_LETTER%:\Boot">NUL IF NOT EXIST "%BOOT_FOLDER%\boot.sdi" COPY /Y "%APPLYDIR%\Windows\Boot\DVD\EFI\boot.sdi" "%EFI_LETTER%:\Boot">NUL 2>&1 @@ -2707,30 +2620,28 @@ IF NOT EXIST "%EFI_LETTER%:\Boot\boot.sdi" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% IF EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. Using bootmgfw.efi located in folder, for the efi bootloader.&© /Y "%BOOT_FOLDER%\bootmgfw.efi" "%EFI_LETTER%:\EFI\Boot\bootx64.efi">NUL IF NOT EXIST "%BOOT_FOLDER%\bootmgfw.efi" COPY /Y "%APPLYDIR%\Windows\Boot\EFI\bootmgfw.efi" "%EFI_LETTER%:\EFI\Boot\bootx64.efi">NUL 2>&1 IF NOT EXIST "%EFI_LETTER%:\EFI\Boot\bootx64.efi" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% bootmgfw.efi missing.&&GOTO:BOOT_CLEANUP -IF DEFINED PE_WALLPAPER IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" (ECHO. Using %PE_WALLPAPER% located in folder, for the recovery wallpaper. +IF DEFINED PE_WALLPAPER IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" (ECHO. Using %PE_WALLPAPER% for the recovery wallpaper. TAKEOWN /F "%APPLYDIR%\Windows\System32\setup.bmp">NUL 2>&1 ICACLS "%APPLYDIR%\Windows\System32\setup.bmp" /grant %USERNAME%:F>NUL 2>&1 COPY /Y "%CACHE_FOLDER%\%PE_WALLPAPER%" "%APPLYDIR%\Windows\System32\setup.bmp">NUL 2>&1) IF EXIST "%APPLYDIR%\setup.exe" DEL /Q /F "\\?\%APPLYDIR%\setup.exe">NUL 2>&1 -IF EXIST "%APPLYDIR%\$\RECOVERY_LOCK" DEL /Q /F "\\?\%APPLYDIR%\$\RECOVERY_LOCK">NUL 2>&1 COPY /Y "%APPLYDIR%\Windows\System32\config\ELAM" "%TEMP%\BCD">NUL 2>&1 -::ECHO."%%SYSTEMDRIVE%%\$\WINDICK.CMD">"%APPLYDIR%\WINDOWS\SYSTEM32\STARTNET.CMD" -(ECHO.[LaunchApp]&&ECHO.AppPath=X:\$\windick.cmd)>"%APPLYDIR%\Windows\System32\winpeshl.ini" -SET "VHDX_SLOTZ=%VHDX_SLOT0%"&&SET "VHDX_SLOT0=%VHDX_SLOTX%"&&CALL:BCD_CREATE>NUL 2>&1 +::ECHO."%%SYSTEMDRIVE%%\$\%PROG_NAME%.CMD">"%APPLYDIR%\WINDOWS\SYSTEM32\STARTNET.CMD" +(ECHO.[LaunchApp]&&ECHO.AppPath=X:\$\%PROG_NAME%.cmd)>"%APPLYDIR%\Windows\System32\winpeshl.ini" +SET "VHDX_SLOTZ=%VHDX_SLOT0%"&&SET "VHDX_SLOT0=%VHDX_SLOTX%"&&SET "HOST_X=%HOST_FOLDER%"&&CALL:BCD_CREATE>NUL 2>&1 SET "VHDX_SLOT0=%VHDX_SLOTZ%"&&SET "VHDX_SLOTZ="&&IF NOT EXIST "%EFI_LETTER%:\EFI\Microsoft\Boot\BCD" SET "ERROR=1"&&ECHO. %XLR2%ERROR:%#$% BCD missing.&&GOTO:BOOT_CLEANUP ::DISM /IMAGE:"%APPLYDIR%" /SET-SCRATCHSPACE:512 >NUL 2>&1 -ECHO. Saving boot-media...&&CALL:TITLECARD -SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&CALL:CAPTURE_IMAGE +ECHO. Saving boot-media...&&SET "IMAGEFILE=%EFI_LETTER%:\$.WIM"&&SET "CAPTUREDIR=%VDISK_LTR%:" +DISM /ENGLISH /CAPTURE-IMAGE /IMAGEFILE:"%IMAGEFILE%" /CAPTUREDIR:"%CAPTUREDIR%" /NAME:NAME /CheckIntegrity /Verify /Bootable&ECHO.&SET "IMAGEFILE=" :BOOT_CLEANUP -ECHO. Unmounting temporary vdisk...&&SET "VDISK=%PRI_LETTER%:\$\Scratch\scratch.vhdx"&&CALL:VDISK_DETACH>NUL 2>&1 -ECHO. Unmounting EFI...&&IF EXIST "%PRI_LETTER%:\$\Scratch" RD /S /Q "%PRI_LETTER%:\$\Scratch">NUL 2>&1 +ECHO. Unmounting temporary vdisk...&&SET "VDISK=%PRI_LETTER%:\%HOST_FOLDER%\scratch\scratch.vhdx"&&CALL:VDISK_DETACH>NUL 2>&1 +ECHO. Unmounting EFI...&&IF EXIST "%PRI_LETTER%:\%HOST_FOLDER%\scratch" RD /S /Q "%PRI_LETTER%:\%HOST_FOLDER%\scratch">NUL 2>&1 SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=1"&&SET "LETT_X=%EFI_LETTER%"&&CALL:PART_REMOVE SET "DISK_X=%DISK_DETECT%"&&SET "PART_X=1"&&CALL:PART_EFIX -IF NOT DEFINED ERROR (IF EXIST "%IMAGE_FOLDER%\%VHDX_SLOTX%" IF EXIST "%PRI_LETTER%:\$" ECHO. Copying %VHDX_SLOTX%...&© /Y "%IMAGE_FOLDER%\%VHDX_SLOTX%" "%PRI_LETTER%:\$">NUL 2>&1 -IF NOT EXIST "%IMAGE_FOLDER%\%VHDX_SLOTX%" ECHO. No virtual hard disk file was selected. -IF EXIST "%BOOT_FOLDER%\boot.sdi" ECHO. Copying boot.sdi...&© /Y "%BOOT_FOLDER%\boot.sdi" "%PRI_LETTER%:\$">NUL 2>&1 -IF EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. Copying bootmgfw.efi...&© /Y "%BOOT_FOLDER%\bootmgfw.efi" "%PRI_LETTER%:\$">NUL 2>&1 -IF DEFINED PE_WALLPAPER IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" ECHO. Copying %PE_WALLPAPER%... &© /Y "%CACHE_FOLDER%\%PE_WALLPAPER%" "%PRI_LETTER%:\$">NUL 2>&1 +IF NOT DEFINED ERROR (IF DEFINED VHDX_SLOTX IF EXIST "%IMAGE_FOLDER%\%VHDX_SLOTX%" IF EXIST "%PRI_LETTER%:\%HOST_FOLDER%" ECHO. Copying %VHDX_SLOTX%...&© /Y "%IMAGE_FOLDER%\%VHDX_SLOTX%" "%PRI_LETTER%:\%HOST_FOLDER%">NUL 2>&1 +IF EXIST "%BOOT_FOLDER%\boot.sdi" ECHO. Copying boot.sdi...&© /Y "%BOOT_FOLDER%\boot.sdi" "%PRI_LETTER%:\%HOST_FOLDER%">NUL 2>&1 +IF EXIST "%BOOT_FOLDER%\bootmgfw.efi" ECHO. Copying bootmgfw.efi...&© /Y "%BOOT_FOLDER%\bootmgfw.efi" "%PRI_LETTER%:\%HOST_FOLDER%">NUL 2>&1 +IF DEFINED PE_WALLPAPER IF EXIST "%CACHE_FOLDER%\%PE_WALLPAPER%" ECHO. Copying %PE_WALLPAPER%... &© /Y "%CACHE_FOLDER%\%PE_WALLPAPER%" "%PRI_LETTER%:\%HOST_FOLDER%">NUL 2>&1 FOR %%a in (0 1 2 3 4 5 6 7 8 9) DO (CALL SET "ADDFILE_CHK=%%ADDFILE_%%a%%"&&CALL:ADDFILE_COPY)) CALL SET "VDISK_CHK=%%DISK_%DISK_DETECT%%%" IF "%VDISK_CHK%"=="VDISK" SET "$LTR=%PRI_LETTER%"&&CALL:DISKMGR_UNMOUNT @@ -2738,6 +2649,14 @@ IF "%VDISK_CHK%"=="VDISK" SET "$LTR=%PRI_LETTER%"&&CALL:DISKMGR_UNMOUNT SET "IMAGEFILE="&&SET "IMAGEINDEX="&&SET "ADDFILE_CHK="&&SET "VDISK_CHK="&&SET "PATH_TEMP="&&SET "PATH_FILE="&&SET "EFI_LETTER="&&SET "PRI_LETTER="&&SET "TST_LETTER="&&IF "%PROG_MODE%"=="RAMDISK" CALL:HOST_AUTO>NUL 2>&1 CALL:DEL_DSK&&ECHO.&&ECHO. %#@%BOOT CREATOR END:%#$% %DATE% %TIME%&&CALL:BOXB2 EXIT /B +:FIND_INDEX +IF NOT DEFINED IMAGEFILE EXIT /B +SET "IMAGEINDEX="&&CALL SET /A "INDEX_TMP+=1" +FOR /F "TOKENS=5 SKIP=5 DELIMS=<> " %%a in ('DISM /ENGLISH /GET-IMAGEINFO /IMAGEFILE:"%IMAGEFILE%" /INDEX:%INDEX_TMP% 2^>NUL') DO (IF "%%a"=="%INDEX_WORD%" SET "IMAGEINDEX=%INDEX_TMP%"&&GOTO:FIND_INDEX_BREAK) +IF NOT DEFINED IMAGEINDEX IF NOT "%INDEX_TMP%" EQU "20" GOTO:FIND_INDEX +:FIND_INDEX_BREAK +SET "IMAGEFILE="&&SET "INDEX_TMP="&&SET "INDEX_WORD=" +EXIT /B :ADDFILE_COPY IF "%ADDFILE_CHK%"=="SELECT" EXIT /B SET "PATH_TEMP="&&SET "PATH_FILE="&&FOR /F "TOKENS=1-9 DELIMS=\" %%a in ("%ADDFILE_CHK%") DO ( @@ -2746,7 +2665,34 @@ IF "%%a"=="list" SET "PATH_TEMP=%LIST_FOLDER%"&&SET "PATH_FILE=%%b" IF "%%a"=="image" SET "PATH_TEMP=%IMAGE_FOLDER%"&&SET "PATH_FILE=%%b" IF "%%a"=="cache" SET "PATH_TEMP=%CACHE_FOLDER%"&&SET "PATH_FILE=%%b" IF "%%a"=="main" SET "PATH_TEMP=%PROG_SOURCE%"&&SET "PATH_FILE=%%b") -IF DEFINED PATH_TEMP IF DEFINED PATH_FILE IF EXIST "%PATH_TEMP%\%PATH_FILE%" IF NOT EXIST "%PATH_TEMP%\%PATH_FILE%\*" ECHO. Copying %PATH_FILE%...&© /Y "%PATH_TEMP%\%PATH_FILE%" "%PRI_LETTER%:\$">NUL 2>&1 +IF DEFINED PATH_TEMP IF DEFINED PATH_FILE IF EXIST "%PATH_TEMP%\%PATH_FILE%" IF NOT EXIST "%PATH_TEMP%\%PATH_FILE%\*" ECHO. Copying %PATH_FILE%...&© /Y "%PATH_TEMP%\%PATH_FILE%" "%PRI_LETTER%:\%HOST_FOLDER%">NUL 2>&1 +EXIT /B +:BCD_MENU +CLS&&CALL:SETS_HANDLER&&CALL:CLEAN&&CALL:PAD_LINE&&CALL:BOXT1&&IF NOT DEFINED BOOT_TIMEOUT SET "BOOT_TIMEOUT=5" +ECHO. Boot Menu Editor&&ECHO.&&ECHO. Time (%##%T%#$%^) %#@%%BOOT_TIMEOUT%%#$% seconds +FOR %%G in (0 1 2 3 4 5 6 7 8 9) DO (CALL ECHO. Slot ^(%##%%%G%#$%^) %#@%%%VHDX_SLOT%%G%%%#$%) +ECHO.&&ECHO. Press (%##%X%#$%) to apply boot menu settings&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +IF NOT DEFINED SELECT EXIT /B +IF "%SELECT%"=="T" CALL:BOOT_TIMEOUT&SET "SELECT=" +IF "%SELECT%"=="X" IF "%PROG_MODE%"=="RAMDISK" CALL:BCD_REBUILD&SET "SELECT=" +FOR %%G in (0 1 2 3 4 5 6 7 8 9) DO (IF "%SELECT%"=="%%G" SET "$VHDX=%%G"&&CALL:VHDX_CHECK&SET "SELECT=") +GOTO:BCD_MENU +:BOOT_TIMEOUT +CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Enter boot menu timeout in seconds&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +SET "CHECK=NUM"&&SET "CHECK_VAR=%SELECT%"&&CALL:CHECK +IF NOT DEFINED ERROR SET "BOOT_TIMEOUT=%SELECT%" +IF DEFINED ERROR SET "BOOT_TIMEOUT=" +EXIT /B +:VHDX_CHECK +CLS&&IF "%$VHDX%"=="X" SET "MENUT0= Boot Creator"&&SET "MENUT1= "&&SET "MENUT2= %#@%AVAILABLE VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=VHDX"&&CALL:FILE_PICK +IF "%$VHDX%"=="X" IF "%SELECT%"=="." SET "FILE_TYPE=VHDX"&&CALL:BASIC_FILE&SET "ERROR=1"&EXIT /B +IF NOT "%$VHDX%"=="X" SET "MENUT0= Boot Menu Editor"&&SET "MENUT1= "&&SET "MENUT2= %#@%MAIN FOLDER VHDXs:%#$%"&&SET "MENUT3= "&&SET "MENUT4= ( %##%.%#$% ) File Operation"&&SET "MENUB0= "&&SET "PICK=CUST"&&SET "$FOLD0=%PROG_SOURCE%"&&SET "$FILT0=*.VHDX"&&CALL:FILE_PICK +IF NOT "%$VHDX%"=="X" IF "%SELECT%"=="." SET "FILE_TYPE=MAIN"&&CALL:BASIC_FILE&SET "ERROR=1"&EXIT /B +IF NOT DEFINED $PICK SET "VHDX_SLOT%$VHDX%="&&SET "$VHDX="&&EXIT /B +SET "CHAR_STR=%$TRUMP%"&&SET "CHAR_CHK= "&&CALL:CHAR_CHK +IF DEFINED CHAR_FLG CALL:PAD_LINE&&CALL:BOXT1&&ECHO.&&ECHO. Remove the space from the VHDX name, then try again.&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&SET "VHDX_SLOT%$VHDX%="&&CALL:PAUSED +IF NOT DEFINED CHAR_FLG SET "VHDX_SLOT%$VHDX%=%$TRUMP%" +SET "$VHDX=" EXIT /B :BCD_CREATE IF NOT DEFINED BOOT_TIMEOUT SET "BOOT_TIMEOUT=5" @@ -2789,22 +2735,22 @@ SET "BCD_GUID="&&SET "BCD_FILE="&&SET "BCD_KEY="&&SET "BCD_NAME="&&EXIT /B IF NOT DEFINED BCD_NAME EXIT /B IF "%BCD_NAME%"=="SELECT" EXIT /B FOR /f "TOKENS=3" %%a in ('BCDEDIT.EXE /STORE "%BCD_FILE%" /create /application osloader') do SET "BCD_GUID=%%a" -BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% device vhd=[locate]\$\%BCD_NAME% +BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% device vhd=[locate]\%HOST_X%\%BCD_NAME% BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% path \Windows\SYSTEM32\winload.efi -BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% osdevice vhd=[locate]\$\%BCD_NAME% +BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% osdevice vhd=[locate]\%HOST_X%\%BCD_NAME% BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% systemroot \Windows BCDEDIT.EXE /STORE "%BCD_FILE%" /SET %BCD_GUID% description "%BCD_NAME%" BCDEDIT.EXE /STORE "%BCD_FILE%" /displayorder %BCD_GUID% /addfirst EXIT /B :BCD_REBUILD -ECHO. Saving Boot Menu...&&CALL:EFI_MOUNT -IF NOT DEFINED ERROR CALL:BCD_CREATE>NUL 2>&1 +ECHO. Saving boot menu...&&CALL:EFI_MOUNT +IF NOT DEFINED ERROR SET "HOST_X=%HOST_FOLDERX%"&&CALL:BCD_CREATE>NUL 2>&1 CALL:EFI_UNMOUNT&&ECHO. Done. EXIT /B ::######################################################################### :TASK_MENU ::######################################################################### -@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:TITLE_X&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Tasks&&ECHO.&&ECHO. (%##%1%#$%) End Task&&ECHO. (%##%2%#$%) SFC /Scannow&&ECHO. (%##%3%#$%) AutoBoot&&ECHO. (%##%4%#$%) Sysprep&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +@ECHO OFF&&CLS&&CALL:SETS_HANDLER&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Tasks&&ECHO.&&ECHO. (%##%1%#$%) End Task&&ECHO. (%##%2%#$%) SFC /Scannow&&ECHO. (%##%3%#$%) AutoBoot&&ECHO. (%##%4%#$%) Sysprep&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT IF NOT DEFINED SELECT GOTO:MAIN_MENU IF DEFINED HOST_ERROR GOTO:MAIN_MENU FOR %%a in (1 2 3 4) DO (IF "%%a"=="%SELECT%" CALL:T%SELECT%X) @@ -2831,7 +2777,7 @@ IF NOT "%CONFIRM%"=="X" SET "ERROR=1"&&EXIT /B SFC /SCANNOW EXIT /B :T3X -@ECHO OFF&&CLS&&CALL:TITLE_X&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. AutoBoot Menu&&ECHO. +@ECHO OFF&&CLS&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. AutoBoot Menu&&ECHO. IF NOT "%PROG_MODE%"=="RAMDISK" ECHO. (%##%1%#$%) Install AutoBoot Switcher&&ECHO. (%##%2%#$%) Remove AutoBoot Switcher IF "%PROG_MODE%"=="RAMDISK" ECHO. (%##%*%#$%)Enable/Disable %#@%%AUTOBOOT%%#$%&&IF "%AUTOBOOT%"=="ENABLED" ECHO. (%##%3%#$%) Edit AutoBoot.cmd ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT @@ -2872,18 +2818,18 @@ ECHO.:: Script cannot have an EXIT otherwise it goes into the main menu. ECHO.::Autoboot service must be installed within host OS to switch upon boot. ECHO.::==========================START OF AUTOBOOT============================ ECHO.ECHO.- AutoBoot - Example - Your Script - Goes here - -ECHO.:: Example of a VHDX backup/Restore - Host Folder = Z:\$ -ECHO.REM if exist "Z:\$\x.vhdx" del /f "Z:\$\x.vhdx" -ECHO.REM if exist "Z:\$\image\x.vhdx" del /f "Z:\$\image\x.vhdx" +ECHO.:: Example of a VHDX backup/Restore - Host Folder = Z:\%HOST_FOLDERX% +ECHO.REM if exist "Z:\%HOST_FOLDERX%\x.vhdx" del /f "Z:\%HOST_FOLDERX%\x.vhdx" +ECHO.REM if exist "Z:\%HOST_FOLDERX%\image\x.vhdx" del /f "Z:\%HOST_FOLDERX%\image\x.vhdx" ECHO.REM windick.cmd -imageproc -wim x.wim -index 1 -vhdx x.vhdx -size 25600 -ECHO.REM if exist "Z:\$\image\x.vhdx" move /y "Z:\$\image\x.vhdx" Z:\$ +ECHO.REM if exist "Z:\%HOST_FOLDERX%\image\x.vhdx" move /y "Z:\%HOST_FOLDERX%\image\x.vhdx" Z:\%HOST_FOLDERX% ECHO.PAUSE ECHO.::===========================END OF AUTOBOOT============================= ECHO.::======================================================================= EXIT /B :T4X CLS&&IF NOT EXIST "%WINDIR%\SYSTEM32\SYSPREP\SYSPREP.EXE" ECHO. %XLR4%ERROR:%#$% Sysprep is unavailable.&&EXIT /B -CALL:TITLE_X&&CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Sysprep Menu&&ECHO.&&ECHO. (%##%1%#$%) Audit Mode&&ECHO. (%##%2%#$%) Generalize&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT +CALL:PAD_LINE&&CALL:BOXT1&&ECHO. Sysprep Menu&&ECHO.&&ECHO. (%##%1%#$%) Audit Mode&&ECHO. (%##%2%#$%) Generalize&&ECHO.&&CALL:BOXB1&&CALL:PAD_LINE&&CALL:PAD_PREV&&CALL:MENU_SELECT IF "%SELECT%"=="1" CALL:SYSPREP_AUD&SET "SELECT=" IF "%SELECT%"=="2" CALL:SYSPREP_GEN&SET "SELECT=" EXIT /B @@ -2910,8 +2856,6 @@ EXIT /B :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::OK PAUSE&&EXIT /B :QUIT -CALL:SETS_HANDLER>NUL 2>&1 -:CLEAN_EXIT IF "%PROG_MODE%"=="RAMDISK" IF "%HOST_HIDE%"=="ENABLED" CALL:HOST_HIDE COLOR&&TITLE C:\Windows\system32\CMD.exe&&CD /D "%ORIG_CD%" IF "%PROG_MODE%"=="RAMDISK" EXIT 0&&EXIT 0 \ No newline at end of file