0
点赞
收藏
分享

微信扫一扫

cmd检测程序是否启动

苦茶如歌 2022-07-28 阅读 162
编程语言

rem 通过/fo csv可以显示完整的映像名称


@echo off
setlocal enabledelayedexpansion
set serviceExe=test.exe


for /l %%i in (1,1,5) do (
set isStart=false
tasklist /fo csv | findstr %serviceExe% && set isStart=true

echo !isstart!

if !isStart!==true (
echo isstart
taskkill /f /im test.exe
timeout 5
) else (
echo nostart
goto end
)
)

:end
echo end



举报

相关推荐

0 条评论