Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Watching for System Shutdown

Keywords:    IntControl 1005 

NT-Shutdown Question:

Can Winbatch detect a NT or Win95 system shutdown? I need to interrupt the shutdown, perform a series of steps and then allow the shutdown to continue.

I wrote a script wich closes all running services before shutdown. Does anybody know where I can find the key to run programs before shutting down ?

Answer:

  1. The current versions (starting in WinBatch version 97A) can do this. Look at IntControl 1005 in the help file.

  2. I don't know of any "pre=shutdown" key.

    Ummm... WinBatch IntControl 1005 will give you a SHORT (15 seconds?) amount of time to do shutdown processing.

    IntControl 1005 is designed to watch for shutdown state, and then run the current WB script in the 20 seconds preceding shutdown. It will launch when you hit either Restart or Log off the current user. It's not designed to resume the WB script after startup.

  3. Although WB can make attempts to prevent WB from being shutdown, we have no ironclad method with which to do that. IntControl(12,8,0,0,0) should prevent the CTRL-Break termination of the script, but it can't prevent someone from killing the script with Ctrl-Alt-Delete.

  4. Best way to ensure enough time for stopping processes before shutting down system is to control the shutdown process in it's entirety.

    We set a system policy to disable the shutdown command and then replace this with an icon/WinBatch compiled script called shutdwn (copied into Windows directory) that does a nice orderly shutdown of services and then uses INT 66,67 and 68 (restart, shutdown and relogin, not necessarily in that order) presented in a dialog box for the users depending on which condition they want.

    Code from one of our users is available in the Article #W13315.


Article ID:   W13323
Filename:   Watch for Shutdown and Perform a Series of Things.txt