WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Launching WinBatch and Other Apps
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Run a Job Once Every Time the System is Restarted

Keywords: 	 run once  service

Question:

How do I run a job not once-a-day, but once each time the system is restarted?

Answer:

Running once each time the system is started is just a little bit more difficult. The 'startup' folder and the 'Run' key in the registry are not sufficient because progs being started via these methods get started everytime somebody does a logon on the computer. Since it is possible to have several users logon and then logout on a computer between reboots these methods will not meet your requirements.

On Win9x computers you can have a program run via the 'RunServices' registry key. This works in the same way that the 'Run' key is processed. This is done under the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion" key. In the subkey "RunServices" you create string values, with the name of the string value identifying what it is and the value determining what program is to be run and what its command line parameters are, too.

On WinNT computers you will have to get the SRVANY utility from the WinNT Res Kit and use it to launch your WinBatch script as a service. Please note that if your script terminates the SRVANY program will still report that your service is running when viewed in the control panel. It will be necessary for your script to make use of the NT network extender to shut the service down properly once it is done running. You may need to use some IntControl() function calls to allow your script to be terminated during service shutdown w/o trying to interact with the desktop, e.g. terminate messages, etc...

You can then have your compiled script do whatever needs to be done at system boot time and then exit when done.


Article ID:   W14246
Filename:   Run Once Every Time System is Restarted.txt
File Created: 1999:10:26:11:22:48
Last Updated: 1999:10:26:11:22:48