如何从另一个批处理文件调用Windows批处理文件

时间:2010-04-09 18:09:09

标签: batch-file dos

我需要创建一个批处理文件,用于更改特定文件夹的路径并执行一组其他bat文件。

我的批处理文件如下所示:

start cd c:\temp\
command1
command2

但它不起作用。它只是改变了C:\Temp的路径,但忽略了下一行。

我该如何解决这个问题?

谢谢。

6 个答案:

答案 0 :(得分:3)

尝试:

cd c:\temp
start command1 
start command2

答案 1 :(得分:2)

将“call”放在对其他.bat文件的引用之前。像这样,

cd c:\temp
call command1 
call command2

答案 2 :(得分:1)

不要忘记检查你是否真的在驾驶c。首先尝试先执行“c:”。

c:
cd c:\temp\

答案 3 :(得分:0)

如果您取出start命令,它应该有效。

cd c:\temp\
command1
command2

答案 4 :(得分:0)

只需添加CD c:\temp

cd c:\temp\
command1
command2

甚至:

cd c:\temp\
start /W command1
start /W command2

答案 5 :(得分:0)

cd c:\temp
cmd /c command1 
start command2