Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Loop til outlook.exe is not running
Name: AJ (by William Jimenez) Date: October 21, 2008 at 07:56:47 Pacific OS: windows XP CPU/Ram: Dell
Comment:
Hello,
I wrote a small batch that amongst other things checks if MS Outlook is running, if so closes outlook and backs up the pst files then restarts outlook.
I do this using PV.exe then checking the errorlevel output and if it is 1 (not running) I start the backup, otherwise the taskkill /IM outlook.exe terminates outlook.
pv > C:\result.txt
findstr /I "OUTLOOK" C:\result.txt if ERRORLEVEL 1 GOTO START
My problem is that this only runs once and as we all know users sometimes will start multiple instances of Outlook.exe
I'm by no means a programmer so take it easy on me, I've been trying unsuccessfully to write a loop that will cicle through the above code until error level =1 (not running) but I have failed miserably.
Name: IVO Date: October 21, 2008 at 12:25:21 Pacific
Reply:
amlife,
you posted an endless loop!
Reread the original question and think about...
0
Response Number 4
Name: AJ (by William Jimenez) Date: October 22, 2008 at 07:51:12 Pacific
Reply:
Thank you all for your ideas. I wanted to let you know that i actually found a very easy way to do it. PV.exe has two switches that allows me to do this.
-k kill process -k outlook* will kill one of anything starting with the word outlook
-r[errorlevel] will continue looping until errorlevel=1 or 0 (1=yes 0=no)
-f will suppress asking for confirmation.
So my problem was solved by this simple line
pv -k outlook* -r1 -f
Thank you all once again this is a great board. I've found more answers here than anywhere else on the net. My hat is off to you all.
Summary: HI i'm making a program which runs another program to do some work, when that program is done running it writes some information to a couple files for my main program to read (wow how many times did i...
Summary: Hi, I installed borland C++ version 3.0 in my PC, but the C++ program is not running at all; when I click the turbo C++ to get into that window...nothing works.. C++ window creates freeze situ...
Summary: Hi, I have one program was running on winnt4 work station . but i have ugraded the same to win 200 prof. now the exe is not running . the source code is in vb6 . when i am trying to run it from source...