Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
setlocal
set exeName=%~1
if "%~1"=="" set /p exeName=Enter program name to check:
if "%exeName%"=="" goto :EOF
set found=
for /f "tokens=*" %%a in ('tasklist ^| findstr /i "%exeName%"') do set found=Y
if "%found%"=="Y" goto :EOF
echo Running %exeName%