Re: Delay a Windows Service to start
I can't comment on your method since I have not tried it so
far. However, the following method will work. It will start
the "Windows Time" service some 60 seconds after you
start your own custom-made service.
1. Create the batch file c:\Windows\Joel.bat with these lines:
@echo off
%SystemRoot%\System32\cmd.exe /c echo Start %time% >> c:\test.txt
%SystemRoot%\System32\ping.exe localhost -n 60
%SystemRoot%\System32\net.exe start "Windows time"
%SystemRoot%\System32\cmd.exe /c echo End %time% >> c:\test.txt
%SystemRoot%\System32\cmd.exe /c echo. >> c:\test.txt
2. Go through the motions of this KB article:
http://support.microsoft.com/kb/137890
When entering the data for the "Application" value, enter this:
c:\windows\system32\cmd.exe /c c:\windows\Joel.bat
3. Manually stop the "Windows Time" service.
4. Manually start the service you have just created under the guidance
of the KB article.
5. Check the contents of c:\test.txt.
6. Adjust c:\windows\Joel.bat to suit your requirements.
"Joel" <Joel@discussions.microsoft.com> wrote in message
news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@microsoft.com...
> Hi!
> I took VS 2005 with the help of an article
> http://msdn2.microsoft.com/en-us/library/zt39148a(VS.80).aspx
> In the onStart I just put a loop because I tought that the service was
> changing is status to started after going in the OnStart event. I'm really
> not a Windows Service programmer specialist.
>
> Regards, Joel
> "Pegasus (MVP)" wrote:
>
>>
>> "Joel" <Joel@discussions.microsoft.com> wrote in message
>> news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@microsoft.com...
>> > Bonjour!
>> > I have a service that I want to delay because it needs to be up before
>> > end.
>> > So I created a Windows service (Delay Service) and my application will
>> > start
>> > after that service has started but it doesn't work. In the OnStart of
>> > the
>> > service I loop for one minute, but when I install the service and
>> > start,
>> > it
>> > automatically say's it is started even if I have that loop.
>> > Does someone had a similar and how did you solved it??
>> >
>> > Regards Joel
>>
>> How did you create this service? What are its commands?
>> How did you implement the delay?
>>
>>
>>