Re: Delay a Windows Service to start
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Tue, 8 Apr 2008 20:54:11 +0200
You can probably improve the method by adding this line
to your batch file:
%SystemRoot%\System32\net.exe stop "NameOfYourService"
since there is no need for your service to keep on running after
it has delay-started the original service. Let me know how you go!
"Joel" <Joel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1E1B9C32-A6B3-42B0-8880-A197B460FBE7@xxxxxxxxxxxxxxxx
WoW! I think that will work, I really appriciate your answer,
Regards, Joel :)
"Pegasus (MVP)" wrote:
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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4FE66034-A426-4F99-ADE2-FB30C5C0DEF2@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E0C46BBB-2149-4C9B-9CE6-51DF2154996B@xxxxxxxxxxxxxxxx
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?
.
- References:
- Delay a Windows Service to start
- From: Joel
- Re: Delay a Windows Service to start
- From: Pegasus \(MVP\)
- Re: Delay a Windows Service to start
- From: Joel
- Re: Delay a Windows Service to start
- From: Pegasus \(MVP\)
- Re: Delay a Windows Service to start
- From: Joel
- Delay a Windows Service to start
- Prev by Date: Re: Can't view reg key HKLM\SW\MS\Windows\CurrentVersion
- Next by Date: Schedule system state backups on W2K8?
- Previous by thread: Re: Delay a Windows Service to start
- Next by thread: Re: RDP stopped working
- Index(es):
Relevant Pages
|