Click to See Complete Forum and Search --> : Windows Registry Shutdown


gilkaths
June 5th, 2005, 11:08 AM
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

PeejAvery
June 8th, 2005, 12:45 PM
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.

Andreas Masur
June 8th, 2005, 12:48 PM
Take a look at the following (http://www.microsoft.com/mspress/books/sampchap/5205e.asp)...

PeejAvery
June 8th, 2005, 01:21 PM
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

Kdr Kane
June 8th, 2005, 03:45 PM
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.

PeejAvery
June 10th, 2005, 10:47 AM
Just out of sheer curiosity, what exactly does this batch file do? Why could you not run in on startup instead of shutdown?

gilkaths
June 18th, 2005, 06:24 AM
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.