Question Locked

Script

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need help in writing a script to schedule the following on a Win XP Pro
workstation:
1. End a running application
2. Start a second application
3. When the second application ends start the first application again.

Thanks,

David

2 replies

by bizzo

Firstly download PsTools from sysinternals and extract pskill.exe
http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx

And here's the batch file, you can replace the applications winword.exe and notepad.exe. It's written so if the first application doesn't exist, or if the first app cannot be stopped, it doesn't start the second.
So here it is:

-----------------------------------
@echo off
pskill winword.exe

if errorlevel 0 goto :kill1
if errorlevel -1 goto :nokill
goto :finish

:nokill
echo No initial process to kill
goto finish

:kill1
start /wait notepad.exe
start winword.exe

:finish

-----------------------------------

This discussion is closed to new replies.