rem run this cmd with Win7 USB key absolute path
rem for example: usb3-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 usb3 driver
if exist .\Driver\ Dism /image:c:\TMPBOOT /add-driver /driver:.\Driver /recurse /forceunsigned

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 usb3 driver
if exist .\Driver\ Dism /image:c:\TMPBOOT /add-driver /driver:.\Driver /recurse /forceunsigned

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 usb3 driver
if exist .\Driver\ Dism /image:c:\TMPBOOT /add-driver /driver:.\Driver /recurse /forceunsigned

rem Unmount wim
DISM.exe /Unmount-Wim /MountDir:C:\TMPBOOT /commit

echo add usb driver into win7 os complete
:end