KeefeJohnson
asked on
How to run a batch file at shutdown on XP HOME?
I would like to run a script/batch file when I choose Start>Shutdown.
I have looked at programs like Karen's Show Stopper, but they only run a script/batch before THEY shutdown the computer.
I have heard about programs like LastChance, but I would like a method that does not have yet another process running to achieve it.
I've looked at Group Policy, but it is not a part of XP Home. I tried to enter the registry entries for GP manually, but nothing happened on shutdown. The GP core is probably not even in XP Home.
Scheduled Tasks only has an option for logon / startup.
Is there any other method [other than upgrading to XP Pro :) ] ?
I have looked at programs like Karen's Show Stopper, but they only run a script/batch before THEY shutdown the computer.
I have heard about programs like LastChance, but I would like a method that does not have yet another process running to achieve it.
I've looked at Group Policy, but it is not a part of XP Home. I tried to enter the registry entries for GP manually, but nothing happened on shutdown. The GP core is probably not even in XP Home.
Scheduled Tasks only has an option for logon / startup.
Is there any other method [other than upgrading to XP Pro :) ] ?
ASKER
Yes, but I would like it to be automatic through Start>Stutdown
Start>Shudown is just a link to the shutdown command.
ASKER
The reason for the shutdown batch file...
I have changed my WinXP kernel to display a different boot screen at startup. If Windows Update installs a kernel patch, it will ask if I want to restart now or later. If I click restart now, I want windows to tell me if the kernel has changed so that I don't use my modified boot screen. I can't configure Windows Update to run a batch before shutting down. So I want windows to do it automatically like Group Policy does in WinXP Pro.
I have changed my WinXP kernel to display a different boot screen at startup. If Windows Update installs a kernel patch, it will ask if I want to restart now or later. If I click restart now, I want windows to tell me if the kernel has changed so that I don't use my modified boot screen. I can't configure Windows Update to run a batch before shutting down. So I want windows to do it automatically like Group Policy does in WinXP Pro.
Add this key and see if it works - what I did was add the shutdown script through gpedit.msc then looked for the key in the reg
HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\Windows\ CurrentVer sion\Group Policy\State\Machine\Scrip ts\Shutdow n\0\0
Following keys
(String value) Parameters - (value) whatever params
(String Value) Parameters - (value) The script location
(Binary) ExecTime - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
HKEY_LOCAL_MACHINE\SOFTWAR
Following keys
(String value) Parameters - (value) whatever params
(String Value) Parameters - (value) The script location
(Binary) ExecTime - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Do the same keys here
HKEY_LOCAL_MACHINE\SOFTWAR E\Policies \Microsoft \Windows\S ystem\Scri pts\Shutdo wn\0\0
HKEY_LOCAL_MACHINE\SOFTWAR
Please backup the registry and do a system restore point first
ASKER
I've tried that already. It seems that not only is gpedit.msc unavailable, but the core isn't even there in XP Home. Windows doesn't do anything even when I do it manually like that in the registry. (Win2000 had GP, why couldn't MS have continued it in XP Home?)
even if you add the second key alone?
ASKER
I have an idea... I'll change Shutdown to Startup, and use RegMon from SysInternals.com to monitor registry acces during boot. Then I'll find out if windows is even looking for the key...
there is one more this with the registry do a search for shutdown and there should be an event to play the shutdown wave file I found it when I did the search. Maybe you could put the script where is calls that file
ASKER
Interesting idea ... Never thought of that ... I'll try it...
ASKER
No, I think Windows is designed to not let that get through. I clicked the preview sound button, and it said the sound file (my batch file) was either damaged or was not a vaild sound file. I tried it with "Critical Stop" and made an error come up. File Monitor said that Windows accessed the file, but never ran it. "Invalid sound file..." "Invalid sound file..." MS, why shouldn't it work? :)
One more thing I thought of; if you remove the shutdown.exe from the system directory where it is sourced. see if you get an error that it can't find the file when you try to use the start>shutdown. If so then maybe you could put a modified shutdown.exe that points to your script first then the actual shutdown.
Modify your boot.ini file and not your kernel.
/BOOTLOGO
Use this switch to have Windows XP or Windows Server 2003 display an installable splash screen instead of the standard splash screen. First, create a 16-color (any 16 colors) 640x480 bitmap and save it in the Windows directory with the name Boot.bmp. Then add "/bootlogo /noguiboot" to the boot.ini selection.
/BOOTLOGO
Use this switch to have Windows XP or Windows Server 2003 display an installable splash screen instead of the standard splash screen. First, create a 16-color (any 16 colors) 640x480 bitmap and save it in the Windows directory with the name Boot.bmp. Then add "/bootlogo /noguiboot" to the boot.ini selection.
ASKER
tymes... Good idea too. I've thought of it, but I wanted a boot screen that had a moving progress bar like the standard, which /bootlogo won't do. I'll do it though if I can't find any other ideas. Thanks.
Report from Registry Monitor: XP Home never accesses a "Group Policy" or "Policies\Microsoft\Window s\System" key when booting up. So I think the GP core isn't even in the OS.
Now I'll try jgiordano's shutdown.exe idea... Maybe I can just replace it with my own...
Report from Registry Monitor: XP Home never accesses a "Group Policy" or "Policies\Microsoft\Window
Now I'll try jgiordano's shutdown.exe idea... Maybe I can just replace it with my own...
ASKER
Windows System File Protector :( I can't delete the file or it comes right back. If I had XP Pro, I could disable access to the file. Is there a way to turn off SFP?
ASKER
Nevermind SFP (WFP). I'll just have to make a progam to monitor when Windows is shutting down.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might also try seeing if gptext.dll exists anywhere on a XP Home machine, if it doesn't then get it from an XP Pro (or from some update like the full Service Pack 2) and copy it to c:\windows\system32, next...
C:\WINDOWS\system32>REGSVR 32 gptext.dll
And see if shutdown scripts start working...
C:\WINDOWS\system32>REGSVR
And see if shutdown scripts start working...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You're right tymes. Although you didn't give me a way to check the kernel at shutdown, you pointed out that there is no point in doing so! I'll probably use your boot.ini solution.
I'll check on that gptext.dll. It would be nice to have GP on XP Home even if I don't use it for this purpose. I'll post the results today.
**** I'm splitting the points between you for your help with this question. Thanks. ****
I'll check on that gptext.dll. It would be nice to have GP on XP Home even if I don't use it for this purpose. I'll post the results today.
**** I'm splitting the points between you for your help with this question. Thanks. ****
ASKER
gptext.dll didn't work for me. Thanks anyway!
If so you could create a batch file to first execute whatever it is you need to do upon shutdown then issue the shutdown .exe command within the same batch file. keep this shortcut on your desktop so you can just dbl click it to shut the computer!