how can run this cmd command "bcdedit /set testsigning on" by c#? this my code - no run :
string strCmdLine;
strCmdLine = "bcdedit /set testsigning on";
Process.Start("CMD.exe", strCmdLine);
how can run this cmd command "bcdedit /set testsigning on" by c#? this my code - no run :
string strCmdLine;
strCmdLine = "bcdedit /set testsigning on";
Process.Start("CMD.exe", strCmdLine);
You can try System.Diagnostics.Process.Start("CMD.exe", "bcdedit /set testsigning on" );
Missing some details on the actual issue here...
Here's my guess, I think you are missing the /c flag.
string strCmdLine;
strCmdLine = "/c bcdedit /set testsigning on";
Process.Start("CMD.exe", strCmdLine);
See the help of cmd.exe for more details on the /c flag (cmd /?).
You can do it like this, just replace "format" with "bcdedit", and "/? with "/set testsigning on"
ProcessStartInfo info = new ProcessStartInfo("format", "/?");
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
string output = Process.Start(info).StandardOutput.ReadToEnd();
Console.WriteLine(output);
You don't need the last 2 lines if you do not care about the output, you should also consider redirecting error output and forwarding it to the console as well (in case you get any error