哎哟,不错哦

导航

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 

  

 

posted on 2019-05-02 22:16  哎哟,不错哦  阅读(279)  评论(0编辑  收藏  举报