Re: Determine if a service has started via batch file

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



That's not quite what you asked. Your original question was: How
to determine if a service has started. The command
net start {ServiceName}
will actually start the service if it can (which is beyond the scope
of your question). Still, if you don't mind starting an inactive service
then your solution will do nicely.


"WB" <WB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CD7B20FE-84EB-40AD-ACC6-698D2B138F76@xxxxxxxxxxxxxxxx
Thanks for the quick reply. net start {service} sets errorlevel=2, so this
will work fine.

Thanks again,
--
Bill Baker


"Pegasus (MVP)" wrote:


"WB" <WB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E9711A82-E9D3-4663-90D2-EB649586B060@xxxxxxxxxxxxxxxx
Is there any way to determine if a service has started via a batch
file? I
tried using "sc" but it doesn't return any errorlevel.

Thanks
--
Bill Baker

Your question is a little ambiguous.
- Do you want to know if a service has been started automatically
or by a batch file command? I don't think you can find out - it
makes no difference how you start the service.
- Do you want to use a batch file in order to determine the status
of a batch file? That's easy - the command
net start | find /i "NameOfService"
will tell you.





.



Relevant Pages

  • Re: log off command
    ... I simply execute the batch file and let them play... ... If it's by the hour you don't need a script. ... You can logoff a sessionname or a session ID in each case you have to ... Is it possible to issue the command from user1's logon to logoff ...
    (microsoft.public.windowsxp.basics)
  • Re: log off command
    ... I simply execute the batch file and let them play... ... If it's by the hour you don't need a script. ... You can logoff a sessionname or a session ID in each case you have to ... Is it possible to issue the command from user1's logon to logoff ...
    (microsoft.public.windowsxp.basics)
  • Re: log off command
    ... SOON 3600 LOGOFF %ID2% ... If it doesn't work please post what the "at" command returns if you run it ... after the batch file and please again describe when it does not work. ... Matija Hrovat ...
    (microsoft.public.windowsxp.basics)
  • Re: Looking for binary file xfer from TRSDOS6/LSDOS6
    ... be wrong with the command line parameters. ... By deleting a few lines from the start of the batch file, ... FTII will eventually reach and transfer the files it just claimed were ... and my list is longer than the buffer can handle. ...
    (comp.sys.tandy)
  • Re: problem with a batch file wkgrp parameter
    ... The short answer is you're using the wrong syntax in your batch file. ... that isn't the secured workgroup information file used to secure the database, ... permission to open this secured database. ... You need to remove the "START /MAX" command, but even then it won't work ...
    (microsoft.public.access.security)