rem run this cmd with Win7 USB key absolute path
rem for example: NVMe-pkg-install.cmd f:
IF "%1" equ "" goto end

dism /cleanup-wim
IF exist C:\TMPBOOT RD /Q /S C:\TMPBOOT
if exist C:\TMPUPD RD /Q /S C:\TMPUPD

echo off
set OS="%1"
MD C:\TMPBOOT
MD C:\TMPUPD

attrib -a -s -h -i -r %OS%\SOURCES\BOOT.WIM
attrib -a -s -h -i -r %OS%\SOURCES\install.WIM



rem update BOOT.WIM on 1
rem Mount wim 
DISM.exe /Mount-Wim /WimFile:%OS%\SOURCES\BOOT.WIM /index:1 /MountDir:C:\TMPBOOT

rem Add KB
DISM.exe /image:c:\TMPBOOT /Add-Package /PackagePath:.\kb\

rem Unmount wim
DISM.exe /Unmount-Wim /MountDir:C:\TMPBOOT /commit

rem update BOOT.WIM on 2
rem Mount wim 
DISM.exe /Mount-Wim /WimFile:%OS%\SOURCES\BOOT.WIM /index:2 /MountDir:C:\TMPBOOT

rem Add KB
DISM.exe /image:c:\TMPBOOT /Add-Package /PackagePath:.\kb\

rem copy updated file to a temp folder
xcopy c:\TMPBOOT\sources\* %OS%\SOURCES\* /D /C /H /R /Y

rem Unmount wim
DISM.exe /Unmount-Wim /MountDir:C:\TMPBOOT /commit

rem update INSTALL.WIM
rem Mount wim 
DISM.exe /Mount-Wim /WimFile:%OS%\SOURCES\INSTALL.WIM /index:1 /MountDir:C:\TMPBOOT

rem Add kb
DISM.exe /image:c:\TMPBOOT /Add-Package /PackagePath:.\kb\

rem Unmount wim
DISM.exe /Unmount-Wim /MountDir:C:\TMPBOOT /commit

echo add NVMe package into win7 os complete
:end