BCDEDIT not recognized when running via C#

前端 未结 2 1353
梦毁少年i
梦毁少年i 2021-01-05 08:15

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, oper

2条回答
  •  迷失自我
    2021-01-05 08:28

    There is one explanation that makes sense:

    1. You are executing the program on a 64 bit machine.
    2. Your C# program is built as x86.
    3. The bcdedit.exe file exists in C:\Windows\System32.
    4. Although C:\Windows\System32 is on your system path, in an x86 process you are subject to the File System Redirector. Which means that C:\Windows\System32 actually resolves to C:\Windows\SysWOW64.
    5. There is no 32 bit version of bcdedit.exe in C:\Windows\SysWOW64.

    The solution is to change your C# program to target AnyCPU or x64.

提交回复
热议问题