batch file在创build服务后停止

我的批处理脚本不会在“service.bat install”之后执行任何行。 我试过了我能想到的一切。 如果我评论这一行,那么一切正常。 似乎脚本在创build服务后停止。 请帮忙。

@echo off net stop Tomcat7 REM ------------- Unzipping the zip file contents to a TEMP folder -------------------- call unzip C:\Test\test.zip -d C:\Test\TEMP REM ------------- Removing the existing folder and updating with the latest war file -- REM rmdir /s /q C:\Test\apache-tomcat-7.0.52-test\webapps\Web copy /y C:\Test\TEMP\Photo.war C:\Test\apache-tomcat-7.0.52-test\webapps xcopy /y C:\Test\TEMP\Scheduler C:\BTest /E sc queryex type= service state= all | find /I "Tomcat7" if %errorlevel% neq 0 ( cd C:\Test\apache-tomcat-7.0.52-test\bin service.bat install) --------------------------------- execution stops here call md C:\Test\Testing REM shutdown.exe /r /t 00 

如果从一个批处理文件直接调用其他批处理文件,执行被转移到被调用的文件,不会返回给调用者。

你需要使用call service.bat install

这样,当被调用的批处理结束时,执行返回给调用者。