How do I launch the Service Controller App that is part of the MMC from C# WinUI 3 app?
Welcome to Microsoft Q&A!
The Service Controller App can be opened by calling the cmd Process(System.Diagnostics) in C#.
Process CmdProcess = new Process(); CmdProcess.StartInfo.FileName = "cmd.exe"; CmdProcess.StartInfo.CreateNoWindow = true; CmdProcess.StartInfo.UseShellExecute = false; CmdProcess.StartInfo.RedirectStandardInput = true; CmdProcess.StartInfo.RedirectStandardOutput = true; CmdProcess.StartInfo.RedirectStandardError = true; CmdProcess.StartInfo.Arguments = "/c " + "services.msc"; //“/C”Indicates to exit immediately after executing the command CmdProcess.Start(); CmdProcess.StandardOutput.ReadToEnd();//get return value CmdProcess.WaitForExit();//Wait for the program to finish executing and exit the process CmdProcess.Close();//END
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
5 people are following this question.