RunTime 启动bat程序
bat文件路径
String cmd= PathUtil.appPath + File.separator + "nginx-1.14.2"+ File.separator +"end.bat";
调用命令Runtime.getRuntime().exec(cmd);
bat文件内容
启动nginx 命令
@echo off if "%1" == "h" goto begin mshtavbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit :begin REM @start /d "D:\nginx-1.14.2" start nginx.exe echo off
关闭nginx命令
@echo off @start taskkill /f /im nginx.exe @echo