How to start `powercfg.exe -energy` from a .NET app?

后端 未结 2 1945
不思量自难忘°
不思量自难忘° 2020-12-12 02:14

When I

using (var process = new Process
{
    StartInfo = new ProcessStartInfo
    {
         FileName = \"powercfg.exe\",
         Arguments = \"-energy\",
         


        
相关标签:
2条回答
  • 2020-12-12 02:57

    I'm afraid I cannot duplicate your results; I get the results file as expected. But if it helps, perhaps my testing parameters will help you narrow down what may be the culprit in your environment:

    • Running Visual Studio 2010 as Administrator
    • Targeted .NET 4 Client Profile
    • Compiled both x86 and Any CPU binaries
    • Computer is running Windows 7 x64
    0 讨论(0)
  • 2020-12-12 03:15

    Set the WorkingDirectory to the path energy.dll and powercfg.exe is located.

    0 讨论(0)
提交回复
热议问题