Created
July 5, 2024 06:38
-
-
Save GarryLai/1a8c60c9eb4167ad902e14ec84490f14 to your computer and use it in GitHub Desktop.
Patch driver (storage, network etc.) into Windows setup ISO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
::::: C O N F I G ::::: | |
set source_path=D:\zh-tw_windows_server_2025_preview_x64_dvd_9b147dcd\sources | |
set driver_path=D:\Software\MegaRAID_Driver | |
set mount_path=C:\Dism_Mount | |
::::::::::::::::::::::: | |
cd "%source_path%" | |
Dism /Get-WimInfo /WimFile:"boot.wim" | |
for /L %%i in (1 1 2) do ( | |
echo %%i | |
mkdir "%mount_path%" | |
Dism /Mount-Image /ImageFile:"boot.wim" /index:%%i /MountDir:"%mount_path%" | |
IF ERRORLEVEL 0 ( | |
Dism /Image:"%mount_path%" /Add-Driver /Driver:"%driver_path%" /Recurse | |
Dism /Image:"%mount_path%" /Get-Drivers | |
Dism /Unmount-Image /MountDir:"%mount_path%" /commit | |
) | |
rmdir /s /q "%mount_path%" | |
) | |
Dism /Get-WimInfo /WimFile:"install.wim" | |
for /L %%i in (1 1 4) do ( | |
echo %%i | |
mkdir "%mount_path%" | |
Dism /Mount-Image /ImageFile:"install.wim" /index:%%i /MountDir:"%mount_path%" | |
IF ERRORLEVEL 0 ( | |
Dism /Image:"%mount_path%" /Add-Driver /Driver:"%driver_path%" /Recurse | |
Dism /Image:"%mount_path%" /Get-Drivers | |
Dism /Unmount-Image /MountDir:"%mount_path%" /commit | |
) | |
rmdir /s /q "%mount_path%" | |
) | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment