我正在尝试编写一个.bat脚本:
我的脚本是这样的:
set /p proj_name=What is project name:
set /p proj_arch=What is the architecture (86 or 64):
REM Build Image
IF %proj_arch% EQU 64 (
echo Building x64 in C:\winPE\builds\%proj_name%
start cmd /C copype amd64 C:\winPE\builds\%proj_name%
) else if %proj_arch% EQU 86 (
echo Building x86 in C:\winPE\builds\%proj_name%
start cmd /C copype x86 C:\winPE\builds\%proj_name%
)
REM Mount image
echo mounted directoy at c:\winpe\mount
DISM /Mount-Wim /WimFile:"C:\winPE\builds\%proj_name%\media\sources\boot.wim" /index:1 /MountDir:"C:\winPE\mount"
Echo =============================================
echo To unmount and create ISO:
pause
Dism /Unmount-Wim /MountDir:"C:\WinPE\mount" /commit
Dism /Cleanup-Mountpoints
echo Creating iso in c:\winpe\
MakeWinPEMedia /ISO C:\winPE\builds\%proj_name% C:\WinPE_amd64\%proj_name%.iso
pause
我的问题是当DISM /mount-wim
在此批次中失败时(即使我将%proj_name%
更改为test
),但在我的脚本运行后它在同一命令提示符下正常工作。例如:
test.bat的
start cmd /C copype amd64 C:\winPE\builds\test
DISM /Mount-Wim /WimFile:"C:\winPE\builds\test\media\sources\boot.wim" /index:1 /MountDir:"C:\winPE\mount"
c:\winpe> cmd test.bat
以wim not found
失败,但是:
test2.bat
start cmd /C copype amd64 C:\winPE\builds\test
c:\winpe> cmd test2.bat
c:\winpe> DISM /Mount-Wim /WimFile:"C:\winPE\builds\test\media\sources\boot.wim" /index:1 /MountDir:"C:\winPE\mount"
成功。
如何让DISM在我的构建脚本中工作?