I have this .bat script which I use to maven package my application. Problem is, just after it ends execution, it closes the console window. The last 2 lines somehow are completely ignored.
我有这个.bat脚本,我用它来maven打包我的应用程序。问题是,在它结束执行后,它会关闭控制台窗口。不知何故,最后两行完全被忽略了。
Does anyone know the trick to make this work? I just want to have a quick check if the build was successful.
有谁知道让这项工作的诀窍?我只是想快速检查一下构建是否成功。
@echo off
cls
cd C:\svn\project
mvn package -o -P local
sleep 3
pause
3 个解决方案
#1
You could try to write
你可以尝试写
call mvn package -o -P local
#2
Here is a hack that I found here:
这是我在这里找到的黑客:
ping 1.0.0.0 -n 1 -w 5000 >NUL
This will ping an unreachable host with a pause in between. Also the standard output is redirected so you don't see it in your output. Not the best solution but will work in a pinch.
这将ping不可到达的主机,中间有一个暂停。此外,标准输出被重定向,因此您不会在输出中看到它。不是最好的解决方案,但会在紧要关头工作。
#3
Windows Server 2003 Resource Kit Tools provides a command line sleep function:
Windows Server 2003资源工具包工具提供命令行睡眠功能:
#1
You could try to write
你可以尝试写
call mvn package -o -P local
#2
Here is a hack that I found here:
这是我在这里找到的黑客:
ping 1.0.0.0 -n 1 -w 5000 >NUL
This will ping an unreachable host with a pause in between. Also the standard output is redirected so you don't see it in your output. Not the best solution but will work in a pinch.
这将ping不可到达的主机,中间有一个暂停。此外,标准输出被重定向,因此您不会在输出中看到它。不是最好的解决方案,但会在紧要关头工作。
#3
Windows Server 2003 Resource Kit Tools provides a command line sleep function:
Windows Server 2003资源工具包工具提供命令行睡眠功能: