拓冰建站拓冰建站
首页 / 资讯中心 / 正文

jar文件,设置开机自启和无窗口模式

准备jar包把下面创建的文件可以都放一个文件夹中创建文件无黑窗口 启动.vbsSet WshShell CreateObject(WScript.Shell)WshShell.Run cmd /c cd /d WshShell.CurrentDirectory javaw -Dfile.encodingUTF-8 -jarxxxxxxx包名.jar--spring.config.locationapplication.yml, 0, FalseMsgBox Modbus service start success., vbInformation, Start双击启动.vbs启动成功会有提示MsgBox Modbus service start success., vbInformation, Start不要提示就把这句删除就行MsgBox Modbus service start success., vbInformation, Start如果是多环境配置模式可以把--spring.config.locationapplication.yml删除或者加--spring.profiles.activexxxxxx避免默认配置无效带黑窗口的 启动.exe文件echo offtitle Modbus采集程序cd /d %~dp0java -Dfile.encodingUTF-8 -jarxxxxx包名.jar--spring.config.locationapplication.ymlpause启动后可以通过下面命令查看端口启动情况如果项目启动的慢需要等一会netstat -ano | findstr :20099 | findstr LISTENING查看端口netstat -ano | findstr :20099创建文件 停止.vbsSet objWMIService GetObject(winmgmts:\\.\root\cimv2)Set colItems objWMIService.ExecQuery(Select * from Win32_Process Where Namejavaw.exe and CommandLine like %xxxxxx包名.jar%)For Each objItem in colItemsobjItem.Terminate()NextMsgBox Modbus service stop success, vbInformation, Stop开机自启右击启动.vbs创建快捷键然后winr输入shell:startup命令把快捷键放进去就行了
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门