我想运行一个批处理文件,它启动其他4个批处理文件。
问题是:只有第一个CMD文件被执行。
我看了这里发布的类似问题:如何在.bat文件中运行多个.bat文件
还有这里:如何从一个批处理文件启动多个带依赖关系的批处理文件?
我的问题与之不同的是,我为每个CMD文件传递一个RootPath。
这个Master.CMD文件包含的代码不在同一个目录下,与Account / Customer / Contract / Location cmd文件不在同一目录下,这就是为什么我要传递绝对路径的原因。 第一个命令运行得很好。然后我收到了错误提示:
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文件包含的代码不在同一个目录下,与Account / Customer / Contract / Location 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上,我无法从其他批处理帖子中推导出解决方案。我对这种语言还很陌生,请原谅我如果我忽略了什么。
任何形式的帮助都是受欢迎的。
CALL "%RootPath%Account.CMD"
。 - Thomas WellerACCOUNT.CMD
重置了RootPath
。环境变量是全局的,除非你使用setlocal
进行隔离。 - wmz