Page 1 of 1

BATCH file for check and start

Posted: 24 Jan 2021 07:08
by ROBGIU1960
I have to create a batch file that before running a program check that the same is not already running (warning if it is).

Otherwise it can start the program.

The program can be found in: C: \ Program files (x86) \ Artel \ arca.exe

Please you create a batch file for me ?

Re: BATCH file for check and start

Posted: 24 Jan 2021 07:22
by aGerman
Give that a go:

Code: Select all

@echo off &setlocal
tasklist /nh /fo csv /fi "imagename eq arca.exe"|>nul find """arca.exe"""
if errorlevel 1 (
  start "" "C:\Program Files (x86)\Artel\arca.exe"
  goto :eof
)

echo Program already running.
pause
Steffen

Re: BATCH file for check and start

Posted: 24 Jan 2021 07:44
by ROBGIU1960
thanks but the file always opens the program even if it is already running

Re: BATCH file for check and start

Posted: 24 Jan 2021 08:32
by aGerman
Might be that arca.exe is only a launcher which terminates as soon as the actual application is running. Try to figure out which process(es) indicate the running program. You may find them in the details tab of the task manager.

Steffen