DISM在.bat中失败,但在命令提示符下运行正常

时间:2015-01-10 04:16:29

标签: batch-file cmd winpe dism

我正在尝试编写一个.bat脚本:

  1. 创建WinPE图像;
  2. 安装图片;
  3. 允许我对图片进行更改;
  4. 提交更改;和
  5. 制作.iso图片。
  6. 我的脚本是这样的:

      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在我的构建脚本中工作?

0 个答案:

没有答案