我想運行一個批處理文件,該文件啓動4個其他批處理文件。 問題:只有第一個CMD文件被執行。如何使用RootPath在bat文件中運行多個bat文件
我看着這裏發表類似的問題:How to run multiple .BAT files within a .BAT file
這裏:How do I launch multiple batch files from one batch file with dependency?
我的問題不同的是,我沿着每個CMD文件ROOTPATH通過。
Examples given in other posts:
call msbuild.bat
call unit-tests.bat
call deploy.bat
My code:
SET RootPath="G:\Dev Folder\Framework\MainFolder\SubFolder\JOBS\"
CALL %RootPath%Account.CMD
CALL %RootPath%Customer.CMD
CALL %RootPath%Contract.CMD
CALL %RootPath%Location.CMD
包含代碼這Master.CMD文件不在同一目錄中的帳戶/客戶/合同/位置CMD文件,這就是爲什麼我傳遞的絕對路徑。 第一個命令運行得很好。然後我得到的錯誤:
'..\Customer.CMD ' is not recognized as en internal or external command, operable program or batch file.
'..\Contract.CMD ' is not recognized as en internal or external command, operable program or batch file.
'..\Location.CMD ' is not recognized as en internal or external command, operable program or batch file.
我不能從其他批處理帖子推演出的解決方案在stackoverflow。我不熟悉這種語言,請原諒我是否忽略了某些內容。
任何和所有的幫助是受歡迎的。
RootPath裏面有一個空格。嘗試使用引號「CALL」%RootPath%Account.CMD「'。 –
這看起來像你的'ACCOUNT.CMD'重置'RootPath'.Env變量是全局變量,除非你用'setlocal'將它們隔離開來。 – wmz
RootPath值有引號。 此外,爲** CALL「%RootPath%Account.CMD」添加引號**似乎無法解決問題 – NetFlash