Link to home
Start Free TrialLog in
Avatar of datzent83
datzent83Flag for United States of America

asked on

Windows XP Close and Re-Open Application

In Windows XP and Widnows 7 I need to be able to close an application (kill it's task) and re-open that applicatin after about 10 seconds. I know this can be donw with a scritp, but not sure how to write it. Maybe there is a simpler way of doing it.
Avatar of BillDL
BillDL
Flag of United Kingdom of Great Britain and Northern Ireland image

What is the application, and exactly how is it listed when you open a CMD window and type this command?:

tasklist /v /fo csv
What are you trying to accomplish by doing that?  Do you know for sure that it will completely shutdown in 10 seconds?
The paid version of Take Command from JPSoft includes the environment variable @WINPID which would facilitate scripting the above based on the title of the application.
However trickier (so not suggesting the above as a solution) is determining whether the application has hung, or whatever the required conditions are, as I doubt your intention is to kill the program every 10 seconds?
ASKER CERTIFIED SOLUTION
Avatar of bmarone
bmarone

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of datzent83

ASKER

Will SLEEP.EXE work with Window XP and Windows 7?
So I run SLEEP.EXE and execute the following script?

set ProcessDir=C:\Program Files\Adobe\Acrobat 6.0\Reader
set ProcessName=AcroRd32.exe
taskkill /f /im %ProcessName%
:WaitTilDead
tasklist /fi "IMAGENAME eq %ProcessName%" |find "%ProcessName%"
if not errorlevel 1 goto WaitTilDead
SLEEP.EXE 10
start "window title" "%ProcessDir%\%ProcessName%"
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial