Wilson WindowWare Tech Support

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


Detect Windows Reboot Needed

Keywords:  Detect Windows Reboot Needed

Question:

After installing software silently, with all reboots suppressed, there is a way to detect that the system has been marked for reboot. Does anyone know how to detect this using WIL.

Answer:

The list of files to be updated is stored in the registry.

Here's the magic key:

If RegExistValue(@RegMachine,"System\CurrentControlSet\Control\Session Manager[PendingFileRenameOperations]") Then *RebootRequired*

If the above does not exist, do the following:

In 95/98/ME check for the existence of the file wininit.ini in the windows directory. (There is probably a wininit.bak from a previous reboot there)

In Windows NT/2000/XP I don't think there is a flag persay that you can check, however most of the time the reason for the reboot is so that system files can be updated.

The list of files to be updated is stored someplace in the registry. If you can find the spot in the registry where the files are stored...then you can look there.

....

To find it...

  1. Make two files
    C:\temp\aaa.txt
    and
    c:\temp\bbb.txt
    
    contents do not matter.

  2. Run this script. DO NOT press OK
    handle=FileOpen("C:\temp\aaa.txt","READ")
    Message("TESTING","DO NOT PRESS OK")
    FileCLose(handle)
    
  3. Now run this script...
    IntControl(30,"c:\temp\bbb.txt","c:\temp\aaa.txt",0,0)
    
  4. Now you can press the OK button from step 2

  5. Now search the registry for aaa.txt and see where it shows up. And figure out how the delayed file move from IntControl 30 works.

Article ID:   W15276