bat判断进程是否存在

setlocal enabledelayedexpansion
@echo off
cd /d D:\work\tool\nginx-1.13.7

set hasit=no
for /F "tokens=1*" %%a in ('tasklist /nh /fi "imagename eq nginx.exe"') do if %%a == nginx.exe set hasit=yes
if %hasit% == yes goto end
start nginx.exe
:end
set hasit=

nginx.exe -s reload

 

 

echo "结束进程"
TASKKILL /F /IM node.exe

echo "启动node"
cd /d D:\workIdel\tm_edc5.0

cnpm run deploy

posted @ 2018-01-04 15:00  Earic  阅读(7864)  评论(0编辑  收藏  举报