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, operable program or batch file.

when i run it via elevated command line i get as expected.

i have 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 have also tried using

p.StartInfo.FileName = @"BCDEDIT.EXE";
p.StartInfo.Arguments = @"";

i have tried the following:

  1. Checking path variables - they are fine.
  2. running visual studio from elevated command prompt.
  3. placing full path.

i am running out of ideas, any idea as to why i am getting this error ?

all i need is the output of the command if there is another way that would work as well. thanks

Edit
Report