Check If Service Is Running C#?


I’m trying to check if a specific service is running on Windows, but so far haven’t been able to get the framework correctly imported. I know I need to import some .NET framework, but when I put in the one that I need, Unity seems now to support it.

Any ideas?


You can do it with cmd in c#

public void CMD(string command){
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.Arguments = "/user:Administrator \"cmd /K " + command + "\""
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "command";
process.StartInfo = startInfo;

i havent tested the code but if it has any errors just tell me