Hello,
I've spent a few hours googling and have come up empty.
I need to create a DOS script (I call them batch files) where I test if a windows based application is running. If so, I want to set focus to the application (similar to the API function 'ShowWindow' or 'SetForegroundWindow'). and if the app is not running - simply run it.
Thanks for any direction on this.
Jon
Test if a Windows-based Application is Running
Moderator: DosItHelp
Re: Test if a Windows-based Application is Running
jonno wrote:Hello,
I've spent a few hours googling and have come up empty.
I need to create a DOS script (I call them batch files) where I test if a windows based application is running.
@echo off
IF "%1" == "" (Echo Syntax... istask {task}&pause&GOTO :eof)
set task=%1
set task=%task:"=%
tasklist /FI "IMAGENAME eq %task%" | find /i "%task%" >NUL:
goto task%ERRORLEVEL%
:task0
Echo INFO: Found task %task%
goto :eof
:task1 Start it
"%task%"
goto :eof