When I try to run BCDEDIT from my C # application, I get the following error:
'bcdedit' is not recognized as an internal or external command, operating program, or batch file.
when I run it using the elevated command line, I get it as expected.
I used the following code:
Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.FileName = @"CMD.EXE"; p.StartInfo.Arguments = @"/C bcdedit"; p.Start(); string output = p.StandardOutput.ReadToEnd(); String error = p.StandardError.ReadToEnd(); p.WaitForExit(); return output;
I also tried using
p.StartInfo.FileName = @"BCDEDIT.EXE"; p.StartInfo.Arguments = @"";
I tried the following:
- Checking path variables - they are fine.
- run visual studio from an elevated command prompt.
- full path placement.
I'm running out of ideas, any idea as to why I get this error?
all i need is the output of the command if there is another way that will work. thanks
james
source share