@echo off

set exeName=RCM_WinSvc

set pid=
for /f "tokens=2 delims=," %%a in ('tasklist /FI "IMAGENAME eq %exeName%.exe" /NH /FO CSV') do set pid=%%~a
if "%pid%"=="" echo No PID found or not running & exit /b
echo The PID is %pid%
taskkill /f /pid %pid%

