Disable Windows service at application launch

SiberianGuy picture SiberianGuy · Jun 16, 2010 · Viewed 8k times · Source

Because of VLC conflict I have to turn off Windows Advanced Text Services at my application launch. Is there any special API for that? Will it work for user with default rights?

Answer

xr280xr picture xr280xr · Apr 2, 2011

The question is titled "Disable Windows service..." but the answers all tell how to stop a service.

Most of what you will find on Google is that you can update the registry to disable a service using something like this:

RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\[YourServiceName]", true);
key.SetValue("Start", 4);

I haven't tried that method but it appears as though it will work. I also came up with a different method that uses sc.exe to disable the service:

Process sc = Process.Start("sc.exe", "config [YourServiceName] start= disabled");