|
Answer» HI,
How to know a service is running or not using DOS Batch commands?
Regards, ArjunNeed more info. What is your OS and why does it have to be DOS batch language?
Let us know. Hi,
My Operating System is Win 2K. My requirenment with the Dos commands is, i want to copy the database file ( Ms Acess file *.mdb). A windows service is running with respective to the service. I want to stop the service while COPYING and again i need to START the service.
So for the first i have to CHEK whether the service is installed or not. Suppose the service is not even installed, if we TRY to stop the service it gives a problem.
That's why i am asking how can we know the particular windows service is installed and running or not?
Regards, Mallikarjun. I'm not sure if the sc command is valid on 2K but you can try this.
Code: [Select] for /f "tokens=1-4" %%a in ('sc query servicename ^| find /i "state"') do ( if %%d==RUNNING sc stop servicename )
Fill in servicename as needed. If sc is not valid on your machine, you probably need to write a script.
Good luck.
|