@echo off
echo "开始执行启动bat脚本"
D:
cd D:\project
tasklist /nh|find /i "javaw.exe" && echo "java已启动" || start javaw -jar -Dloader.path=.,lib,resources aaa.jar
tasklist /nh|find /i "main.exe" && echo "pymain已启动" || start main.exe
cd nginx
tasklist /nh|find /i "nginx.exe" && echo "nginx已启动" || start nginx.exe
echo C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
echo pause
@echo off
echo "开始执行退出bat脚本"
tasklist /nh|find /i "javaw.exe" && start taskkill /f /im javaw.exe || echo "jar已关闭"
tasklist /nh|find /i "nginx.exe" && start taskkill /f /im nginx.exe || echo "nginx已关闭"
tasklist /nh|find /i "main.exe" && start taskkill /f /im main.exe || echo "pymain已关闭"
echo C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
echo pause
'开始执行启动vbs脚本
on error resume next
set y=getobject("winmgmts:\\.\root\cimv2")
set ws=createobject("wscript.shell")
set m=y.execquery("select * from win32_process where name='main.exe'")
set v=y.execquery("select * from win32_process where name='video.exe'")
set mflag=False
set vflag=False
for each i in m
mflag=True
next
for each i in v
vflag=True
next
if mflag=False then ws.Run "D:\weight\main",0,False
if vflag=False then ws.Run "D:\weight\video",0,False
set ws=Nothing
WScript.quit
'开始执行退出vbs脚本
on error resume next
set y=getobject("winmgmts:\\.\root\cimv2")
set ws=createobject("wscript.shell")
set m=y.execquery("select * from win32_process where name='main.exe'")
set v=y.execquery("select * from win32_process where name='video.exe'")
set mflag=False
set vflag=False
for each i in m
mflag=True
next
for each i in v
vflag=True
next
if mflag=True then ws.Run "taskkill /f /im main.exe",0,False
if vflag=True then ws.Run "taskkill /f /im video.exe",0,False
set ws=Nothing
WScript.quit