PDA

View Full Version : Batch file stopping services



Chilling_Silence
23-11-2004, 08:17 PM
Greetings,

Ive got a mate who has a few services he's wanting stopped on his school PC because they're so slow. Most of them are just sorta standard ones in the Service Manager.

He can stop them but not make them manual startup.
Is there any way to make a batch file to stop some of the unneeded services in XP?

One of them thats non-standard is:
C:\WINDOWS\RCSERV.EXE

Any ideas?

Cheers


Chill.

Chilling_Silence
23-11-2004, 08:25 PM
I should expand - The user wants the likes of theming which shows up as:
C:\WINDOWS\System32\svchost.exe -k netsvcs

To be turned off in a .bat file upon login.

Possible?

Cheers


Chill.

Babe Ruth
23-11-2004, 08:54 PM
Chill, I haven't got the full answer but I guess you could do something like the following... you can make this as elegant as you like. HTH
You can also write a vbscript/wmi file that will do all this as well and run appropriately with privileges etc. Also you can use the TASKLIST and TASKKILL commands in a batch script... some of the PS tools from SYSInternals.com can be helpful here also. Knowing the long name of the service is helpful, you can use the command SERVICES.MSC to find/see/change these. The main registry point for services is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es

In a CMD batch script
use the NET STOP {service name} command
e.g.
NET STOP "QoS RSVP"

To set the values for the service in the registry create a text file (e.g. myregservicefile.txt) with the appropriate values for the service see examples below.
Then from a command procedure you can use REGEDIT /S myregservicefile.txt

Note you normally have to be an administrator to be able to do this, but you can use the RUNAS command passing appropriate commands.


Windows Registry Editor Version 5.00

; Set service to start automatically - value =2
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\RSVP]
"Start"=dword:00000002


Windows Registry Editor Version 5.00

; Set service to Manual - value =3
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\RSVP]
"Start"=dword:00000003


Windows Registry Editor Version 5.00

; Set service to disabled - value =4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\RSVP]
"Start"=dword:00000004

parry
23-11-2004, 08:55 PM
This may be what you want. Clicking download just presents a page that has the batch text. By coincedence its from the US flavour of PCW. :-)

http://www.pcworld.com/downloads/file_description/0,fid,23852,00.asp