tags:

views:

21

answers:

1

Hi all,

I am attempting to write a batch file that kills the windows audio service using the following

taskkill /F /FI "Services eq Windows Audio"

however I am unable to get taskkill to handle the space in the service name. Any ideas?

Thanks

+3  A: 

Rather than use taskkill, why can't you use net stop:

net stop "Windows Audio"

net stop will let the service stop gracefully.

Patrick Cuff
thanks Patrick, the issue I have with using net stop is that occasionally the service will not shut down gracefully, are there any more options with net stop that are more forecful?
gavin
Does the service eventually shut down? Sometimes it takes longer for a service to stop than `net stop` allows, but will eventually shut down. You could set up a loop and poll the output of the 'net start' command, looping until "Windows Audio" is not found.Another option would be go get the PID of the AudioSrv service from the `tasklist /svc` command and use that in `taskkill`. The problem with using `taskkill` is that the Windows Audio service is hosted by an instance of `svchost.exe`, which may also be hosting other services. Killing this task will also kill those services.
Patrick Cuff
You can also try the `sc` command to stop the service: `sc stop "AudioSrv"`
Patrick Cuff