Jump to content

Help with a windows script


Recommended Posts

Posted

Can anyone help with this script, having path  issues.

Here is the code:

Quote

@echo off

Pushd "%~dp0" >nul
CD /d "%~dp0" >nul

:: Detect [OS Architecture
IF EXIST "%WinDir%\SysWOW64" (set "arch=x64") else (set "arch=x86")

:: Setting environment path for the Windows setup
Set "Mount=%~dp0Mount"
Set "BootMount=%Mount%\Boot"
Set "BootWim=%~dp0DVD\sources\boot.wim"
Set "InstallMount=%Mount%\Install"
Set "WIM=%~dp0DVD\sources\install.wim"
Set "ImageDefaultLanguage:="

:: Setting dependent tools environment path variables
Set "DISM=%~dp0Bin\DISM\dism.exe"

SET "index=2"
ECHO.
ECHO =====================================================================================================
ECHO Mounting Image %index%
ECHO =====================================================================================================
IF Exist "%BootMount%" RD "%BootMount%"
IF not Exist "%BootMount%" mkdir "%BootMount%"
"%DISM%" /english /Get-WimInfo /WimFile:"%BootWim%"
"%DISM%" /english /Mount-Wim /WimFile:"%BootWim%" /index:"%index%" /MountDir:"%BootMount%"


ECHO.
ECHO =====================================================================================================
ECHO Extracting Setup Media Update to sources boot.wim
ECHO =====================================================================================================
Expand -R "Updates\SetupMedia\*.cab" -F:* "%BootMount%\sources" >nul
For /d %%i in (ar-SA,bg-BG,ca-ES,cs-CZ,da-DK,de-DE,el-GR,en-GB,es-ES,es-MX,et-EE,eu-ES,fi-FI,fr-CA,fr-FR,gl-ES,he-IL,hr-HR,hu-HU,id-Id,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,vi-VN,zh-CN,zh-HK,zh-TW) do (
If "!ImageDefaultLanguage:~1!" neq "%%i" RD /q /s "%BootMount%\sources\%%i" >nul 2>&1
)

:: Unmounting image
"%DISM%" /Unmount-Wim /MountDir:"%BootMount%" /commit

ECHO.
ECHO ================================================================================
ECHO Extracting Setup Media Update to [DVD] folder
ECHO ================================================================================
Expand -R "Updates\SetupMedia\*.cab" -F:* "DVD\sources" >nul
For /d %%i in (ar-SA,bg-BG,ca-ES,cs-CZ,da-DK,de-DE,el-GR,en-GB,es-ES,es-MX,et-EE,eu-ES,fi-FI,fr-CA,fr-FR,gl-ES,he-IL,hr-HR,hu-HU,id-Id,it-IT,ja-JP,ko-KR,lt-LT,lv-LV,nb-NO,nl-NL,pl-PL,pt-BR,pt-PT,ro-RO,sk-SK,sl-SI,sr-Latn-RS,sv-SE,th-TH,tr-TR,uk-UA,vi-VN,zh-CN,zh-HK,zh-TW) do (
If "!ImageDefaultLanguage:~1!" neq "%%i" rd /q /s "DVD\sources\%%i" >nul 2>&1
)

ECHO.
ECHO.
ECHO All Finished.
ECHO.
ECHO Press any key to end the script.
ECHO.
Pause >nul
Exitode i

 

The master of this is MIA

The reason for the above is a constant windows hardware error when running a fresh win 11 iso using virtual box.

The fellow who passed on the code mentions:

Update the boot.wim index2 sources folder and the installation image sources folder with Windows11.0-KB5046339-x64.cab update and everything will be fine.

I created a dir on the root of C drive

with the following sub dir

DVD

Updates

Mount

Appreciate if someone could possibly assist with this? 

×
×
  • Create New...