3

Situation is, i have 3 separate batch files in different locations running start commands on .jar .exe and call command to open index.html through Firefox.

I want to create one global batch-file to run all of these one at a time. Extra hint would be to make a pause (several seconds) in between calling each one of those commands.

These are the commands i am executing in batch files:

echo majmun1
call C:\OKOLINA\additionConsoleApplication1.exe
echo majmun2
call C:\OKOLINA\addition1\jWebSocketSamples-2.0.jar
echo majmun3
call firefox.exe C:\OKOLINA\addition2\index.html
echo majmun4
exit

It only executes call the first one and stops.

4

2 回答 2

6

您需要使用startistead:

echo majmun1
start C:\OKOLINA\additionConsoleApplication1.exe
echo majmun2
start C:\OKOLINA\addition1\jWebSocketSamples-2.0.jar
echo majmun3
start firefox.exe C:\OKOLINA\addition2\index.html
echo majmun4
exit

如果你想在starts 之间暂停,那么你可以使用这个小技巧:

command 1
ping -w 1000 -n 5 127.0.0.1
command 2

它 ping localhost 5 次 ( -n 5) 并在每次 ping 之间等待 1000 毫秒 ( -w 1000),有效地延迟command 2了 5 秒的执行。(您不能使用pause它,因为它等待用户按 Enter 并且没有内置的延迟命令)。

于 2013-11-08T01:35:50.133 回答
1

使用start而不是call启动您的应用程序。

call从另一个批处理程序调用一个批处理程序(文件名参数必须有一个.bat.cmd扩展名)。

另一方面,start启动单独的命令提示符窗口以运行指定的程序或命令。

于 2013-11-08T01:36:16.597 回答