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

Reboot and Shutdown Topics

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

How to Prevent Automatic Reboot after 20 Second Shutdown

Keywords:    intcontrol(1005,

Question:

In order to make Windows 95 free-seating work, I wrote a cunning WinBatch script that invokes a variety of tasks. One of which is that, when Windows 95 enters shut-down mode, the WinBatch pops-up again (Using the IntControl 1005) and starts a few actions. (These actions consist mainly of copying all .INI files in the local Win.-dir to a network location and copying some registry-hive from HKey Local Machine to HKey current User in order to transport them throughout the network.)

Because these actions might take some time, I also implemented a little progress-box with a "percentage complete"-bar.

Although WinBatch is fairly quick (It's the only application running at that time) it might take more than 20 seconds to complete these tasks. Windows 95 then, after those 20 seconds of shut-down mode, unconditionally restarts. This is what I want to prevent.

I Tried using

IntControl (12,10,"Msg",0,0)
which does work in "normal"-mode, but Windows 95 doesn't seem to care about this at all at shut-down time.

So, is there a way to prevent Windows 95 from unconditionally rebooting/restarting after 20 seconds of Shut-Down mode?

Answer:

Not that we know of.

I'm guessing here, but you might be able to run TWO winbatch scripts at startup.

One script has the IntControl 1005 in it, and the other has the IntControl 12. Something like:

;Script 2 is simple - it stops the shutdown process.

	BoxTitle("Reboot Preventer")
	WinHide("")    ; only add this AFTER everything is debugged
	IntControl(12,2,0,l0,0)
	While 1
	   TimeDelay(300)
	endwhile
	; It will NEVER terminate by itself.
Then in the 1005 script, when you are complete, do a:
;Script 1 is your IntControl 1005 script.  It will start processing.
;When it *is* ready to shutdown it uses IntControl 47 to shoot script #2,
;then issues a IntControl 66 67 68 (or something) to complete the shutdown process.

	IntControl(47,"Reboot Preventer")
	TimeDelay(2)
	IntControl(67,0,0,0,0)
The theory is (in NT (or was it 95?) at least) Script 1 will start processing and then script 2 will stop the shutdown process. Then Script 1 will have all the time it wants, and then it shoots script 2, then initiates another shutdown.
Article ID:   W13317
Filename:   Prevent Automatic Reboot after 20 Second Shutdown.txt
File Created: 1999:04:15:16:53:12
Last Updated: 1999:04:15:16:53:12