windows下bat,检测进程是否开启,并启动 |
您所在的位置:网站首页 › 怎么看进程是否启动程序 › windows下bat,检测进程是否开启,并启动 |
(1)goto命令执行循环 (2)tasklist|findstr -i "mysqld.exe" 检测进程是否存在 (3)start "" "D:/a_wnmps/webserver/mysql/bin/mysqld.exe" 执行命令,后面的第一个"",用来允许第二个"..."中有空格 (4)执行不同目录下的bat,两步 1.先 cd /d "D:\a_wnmps\webserver\nginx" // 跳转目录 2.再 Call start_nginx.bat // 执行bat文件 最后,cd /d "D:\a_file" // 返回原来的目录,不然命令行上没东西 (5)choice /t 300 /d y /n > nul 延时,/t后面的300指300秒,也可以用: ping -n 300 127.0.0.1 >nul 延时,-n后面的300指300秒 @echo off title restart bbs set BASE_DIR=%~dp0 %BASE_DIR:~0,2% :again tasklist|findstr /i "mysqld.exe" > nul if ERRORLEVEL 1 ( echo mysqld is off in %Date:~0,4%-%Date:~5,2%-%Date:~8,2% %Time:~0,2%:%Time:~3,2% start "" "D:/a_wnmps/webserver/mysql/bin/mysqld.exe" ) tasklist|findstr /i "nginx.exe" > nul if ERRORLEVEL 1 ( echo nginx is off in %Date:~0,4%-%Date:~5,2%-%Date:~8,2% %Time:~0,2%:%Time:~3,2% cd /d "D:\a_wnmps\webserver\nginx" Call start_nginx.bat ) tasklist|findstr /i "xxfpm.exe" > nul if ERRORLEVEL 1 ( echo xxfpm is off in %Date:~0,4%-%Date:~5,2%-%Date:~8,2% %Time:~0,2%:%Time:~3,2% cd /d "C:\Users\administrator\Desktop\xxfpm\bin" Call start_xxfpm.bat ) cd /d %BASE_DIR% choice /t 300 /d y /n > nul goto again |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |