问题
When I
using (var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "powercfg.exe",
Arguments = "-energy",
RedirectStandardOutput = true,
UseShellExecute = false,
}
})
{
process.Start();
process.WaitForExit();
}
It outputs:
A biblioteca de Diagnóstico de Eficiência de Consumo de Energia (energy.dll) não pôde ser carregada.
Translated to English:
The Energy Consumption Efficiency Diagnostic library (energy.dll) couldn't be loaded.
Even when running as admin.
回答1:
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
回答2:
Set the WorkingDirectory
to the path energy.dll
and powercfg.exe
is located.
来源:https://stackoverflow.com/questions/24106954/error-the-power-efficiency-diagnostic-library-energy-dll-could-not-be-loaded