Windows Registry Shutdown
Hello,
I had created a batch file which is needed to be executed before shutting down the Windows. Is it possible if the user click the shutdown of any kind of Windows OS, it will execute first the batch file I created before continuing shutting down the Windows OS? If this problem can be solve through the registry, can you give me the exact registry path? Thanks
[377 byte] By [
gilkaths] at [2007-11-19 9:41:37]

# 1 Re: Windows Registry Shutdown
There is no way to run an application or a batch file before the shutdown process unless you execute it yourself and then shutdown. Windows is closing applications while shutting down not loading them.
You can write your own shutdown feature and skin that into the Start Menu. Then under that application, make it run the batch file.
# 3 Re: Windows Registry Shutdown
Sorry, I am thinking in Visual Basic realm again. You can run VBScripts on shutdown using Windows Scripting Host.
http://support.microsoft.com/?kbid=198642
# 4 Re: Windows Registry Shutdown
Shutdown scripts can only be managed and run through local Group Policy or Active Directory Group Policy. If Active Directory is not available - or - must be assumed to not be available in the case of an application programmer, then shutdown scripts cannot really be used.
If a developer started trying to modify local group policy, then he/she would have to assume there were no other local policy settings. Any modifications of local policy must be done by hand and cannot not realistically be scripted or programmed.
Don't believe me? Script adding a shutdown script to local policy on several machines. Then make another script to add a new additional shutdown script to all of them.
And besides, he wanted to do this on "any kind of Windows OS". Shutdown scripts can only run on Windows 2000/XP/2003.
There is no registry method for executing a command on shutdown.
The only practical suggestion is to have a service or program running that is monitoring the API notification to all applications that the system is shutting down and execute your program at that time.
# 5 Re: Windows Registry Shutdown
Just out of sheer curiosity, what exactly does this batch file do? Why could you not run in on startup instead of shutdown?
# 6 Re: Windows Registry Shutdown
The batch file backup the data created today into another folder and will only keep 1 month of data in the main database. Everyday, there is plenty of transactions. The batch file is normally executed by the end user manually but of course, some people are just careless and naughty to execute the file. They just gonna shutdown the computer without executing the batch file.