WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Killing and Terminating Apps

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Stop a Looping WinBatch script

Keywords: stop a looping WinBatch script WinTitle 

Question:

I've written a continuous looping script which checks for presence of a lock file, deletes it, then waits half an hour before looping. The script is meant to run continuously, but how can I permit an administrator to stop the script for modifications?

Answer:

In the Main Program Code, when the continuous loop discovers that the window title name is not the normal window title of "Fruitcake Server", it will exit:
mynormaltitle="Fruitcake Server"     ;pick a unique name
WinTitle("",mynormaltitle)	     ;set winbatch window to unique name
while 1
   for xx=1 to 180
   if WinName("")!=mynormaltitle then exit  ;wait for title to change
   TimeDelay(10)
   Next
   If FileExist("xxx")==1 then FileDelete(xxx)
end while
Then create ShutDown Code for a separate WinBatch script, which changes the normal title to "Shutdown":
   WinTitle("Fruitcake Server","Shutdown")

Article ID:   W13266
Filename:   Stopping a Looping WinBatch script.txt
File Created: 1999:04:15:16:52:52
Last Updated: 1999:04:15:16:52:52