Created
August 9, 2016 15:39
-
-
Save ikalininskiy/d88c21a2e44308d9d607cc851e078ed9 to your computer and use it in GitHub Desktop.
Check Process - batch programm (.cmd) for Windows Task Scheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem CheckProcess.cmd | |
@echo off | |
rem Исправь имя процесса по-умолчанию | |
set filename=MyProcess.exe | |
if "%1" neq "" set filename=%1 | |
for /f %%a in ('tasklist /nh /fi "imagename eq %filename%" ^| find /c "%filename%"') do set /a quantity=%%a | |
rem Если запущена 1 и более копий процесса | |
if %quantity% geq 1 goto ALREADY_RUN | |
echo No processes of %filename%! Doing stuff... | |
rem ... Вставь сюда свои команды, когда процесс НЕ запущен ... | |
C:\Users\ikali\Downloads\PokemonGoBot\Release\NecroBot.exe | |
goto END | |
:ALREADY_RUN | |
echo Already run %quantity% processes of %filename% | |
rem ... Вставь сюда свои команды, когда процесс запущен ... | |
:END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment