This an example that show you how to check if a process like (AcroRd32.exe) (Adobe Reader) is running or not, so if isn't running the script try to start it and of course you can kill it after stating it !
@echo off
Title Check process for starting
mode con cols=65 lines=5 & color 9B
Set ProcessPath=%ProgramFiles%\Adobe\Reader 11.0\Reader
set ProcessName=AcroRd32.exe
Tasklist /nh /fi "imagename eq %ProcessName%" | find /i "%ProcessName%" >nul && (
echo %ProcessName% is started
) || (
echo %ProcessName% is not started & Start "" "%ProcessPath%\%ProcessName%"
)
pause
Echo Killing %ProcessName%
Taskkill /IM "%ProcessName%" /F
pause
And this Batch is with menu :
@Echo off & cls & color 0B
Mode con cols=72 lines=10
Set TmpFile=TmpFile.txt
Set Resultat=KillResult.txt
If Exist %TmpFile% Del %TmpFile%
If Exist %Resultat% Del %Resultat%
:menuLOOP
Cls & color 0B
Title Process Starter and Killer by Hackoo 2015
echo.
echo. ==========================Menu============================
echo.
for /f "tokens=1,2,* delims=_ " %%A in ('"findstr /b /c:":menu_" "%~f0""') do echo. %%B %%C
echo.
echo. ==========================================================
set choice=
echo. & set /p choice=Make a choice or hit ENTER to quit: || GOTO :EOF
echo. & call :menu_%choice%
GOTO:menuLOOP
::********************************************************************************************
:menu_1 StartMyProcess
cls & color 0B
echo.
Set /p "MyProcess=Enter the process name "
echo.
echo The process %MyProcess% is started ...
Start %MyProcess%
GOTO :menuLOOP
::********************************************************************************************
:menu_2 KillProcess
Title Process Killer by Hackoo 2015
cls & color 0B
echo.
echo What process do you want to kill ?
echo.
set/p "process=Enter the name of the process> "
cls & color 0C
Title Killing "%process%" ...
echo.
echo Killing "%process%" ...
echo.
echo %date% *** %time% >> %TmpFile%
For %%a in (%process%) Do Call :KillMyProcess %%a
Cmd /U /C Type %TmpFile% > %Resultat%
Start %Resultat%
GOTO :menuLOOP
::*********************************************************************************************
:KillMyProcess
Taskkill /IM "%~1" /F >> %TmpFile% 2>&1
echo ***************************************************************************** >> %TmpFile%
exit /b
::*********************************************************************************************
:EOF
EXIT