windows:scripting:check_if_program_is_running

Check if windows program is running

@echo off
SET IMA=0
tasklist /FI "IMAGENAME eq APP Executable.exe" /FO csv > c:\sched\csv.tmp
FOR /F "usebackq tokens=1 delims=," %%A IN (csv.tmp) DO (
	if %%A == "APP Executable.exe" (
		SET IMA=1
	)
)
 
IF %IMA% == 1 (
	if not exist c:\sched\Notified (
		rem Do something
		touch c:\sched\Notified
	)
	del c:\sched\Notified_E
) else (
	if not exist c:\sched\Notified_E (
		rem Do something
		touch c:\sched\Notified_E	
	)
	del c:\sched\Notified
)
 
:end
del c:\sched\csv.tmp
Enter your comment:
237 +6 = 
 
  • windows/scripting/check_if_program_is_running.txt
  • Last modified: 2020/06/01 14:27
  • by 127.0.0.1