Help with scripting

S

slawal

I am trying to query for services that start with TSM xxxx then stop the
services in the start state without have to write a net stop for every TSM
service. After which I will find the ones in a stopping state and use
taskkill to end the task and I am having problem accomplishing this task. I
am not a scripting guy and I need any help i can get with this
 
P

Pegasus \(MVP\)

slawal said:
I am trying to query for services that start with TSM xxxx then stop the
services in the start state without have to write a net stop for every TSM
service. After which I will find the ones in a stopping state and use
taskkill to end the task and I am having problem accomplishing this task.
I
am not a scripting guy and I need any help i can get with this

Try this:
@echo off
for /F "tokens=*" %%* in ('net start ^| find /i "TSM"') do echo net stop
"%%*"

Please note:
- You must remove the word "echo" in the second line to activate
the batch file.
- You cannot use taskkill.exe to end a service. Taskkill will only
kill tasks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top