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 :) ] ?
LVL 2
KeefeJohnsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jgiordanoCommented:
I am not that familiar with xp home but if you can issue a command from the command line check if you could do a shutdown.exe /? (open up a command window so the screen stays up and you can see if the file is in your system32 folder)

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!
0
KeefeJohnsonAuthor Commented:
Yes, but I would like it to be automatic through Start>Stutdown
0
jgiordanoCommented:
Start>Shudown is just a link to the shutdown command.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

KeefeJohnsonAuthor Commented:
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.
0
jgiordanoCommented:
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\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\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
0
jgiordanoCommented:
Do the same keys here

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System\Scripts\Shutdown\0\0
0
jgiordanoCommented:
Please backup the registry and do a system restore point first
0
KeefeJohnsonAuthor Commented:
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?)
0
jgiordanoCommented:
even if you add the second key alone?
0
KeefeJohnsonAuthor Commented:
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...
0
jgiordanoCommented:
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
0
KeefeJohnsonAuthor Commented:
Interesting idea ... Never thought of that ... I'll try it...
0
KeefeJohnsonAuthor Commented:
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? :)
0
jgiordanoCommented:
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.
0
tymesCommented:
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.
0
KeefeJohnsonAuthor Commented:
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\Windows\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...
0
KeefeJohnsonAuthor Commented:
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?
0
KeefeJohnsonAuthor Commented:
Nevermind SFP (WFP). I'll just have to make a progam to monitor when Windows is shutting down.
0
tymesCommented:
If you're worried about windows updating the kernel and you want to check it hasn't in your own shutdown script.  Will that work?  It requires you to reboot because it is going to update the .dll in a _startup_ script (the file is in use so that is why it has to restart).  Windows will flag the file to be changed next boot up, you'll run your script when you shutdown won't it find nothing? It will start up and change the file when starting in a wininit.ini or similar, not before it shutsdown.

So perhaps you need to use a startup script or eventually use a much smarter shutdown script that checks that an update is scheduled and schedules one of it's own.

Find an update that already updates the file in question and find out how and when it works.  You'll need to know the exact mechanism to counteract the change.  Is the change you want to do a modified .dll or is it a patch that modifies an existing dll?

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tymesCommented:
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>REGSVR32 gptext.dll
And see if shutdown scripts start working...

0
jgiordanoCommented:
If you ever figure this out please post this was a pain!
0
KeefeJohnsonAuthor Commented:
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. ****
0
KeefeJohnsonAuthor Commented:
gptext.dll didn't work for me. Thanks anyway!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.