Discussion Locked

Starting programs after services

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi

I want to know what is the best place to put a batch file to run some programs so that the tasks get run after services have been started and before a user logs in. effectively this is to start some services that need to be delayed so that Oracle has a chance to start before they run

7 replies

by beermonster

Hi,
run gpedit.msc to open up the local group policy. Browse to computer config \ windows \ scripts and add your script to the startup section. To ensure that the services have started, add the following to your batch file -

:loop
rem sleep2
net start | find /I "nameofyourservice"
IF NOT %errorlevel%==0 goto loop

where nameofyourservice is the service name as it appears if you do a 'net start' from a command prompt. The service will only be returned by the net start if it is already started, so as long as the service doesnt show up the code will keep looping until it does. If you have the reskit, you can use sleep.exe to pause the script for a couple of seconds on each pass thru the loop to avoid chewing up processor time bylooping quickly. If you have sleep then just remove the rem before that line to activate it. I can send you sleep.exe if you need it - darthurs@hotmail.com. Hope this helps..

by pameacs

This is the sort of info I was looking for. Thanks I like the way in which you check for the service having started

This discussion is closed to new replies.