如何从 .NET 应用程序启动“powercfg.exe -energy”?
当我
using (var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "powercfg.exe",
Arguments = "-energy",
RedirectStandardOutput = true,
UseShellExecute = false,
}
})
{
process.Start();
process.WaitForExit();
}
输出时:
能源消耗诊断书 (energy.dll) não pôde ser carregada。
翻译成英文:
无法加载能源消耗效率诊断库(energy.dll)。
即使以管理员身份运行。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
恐怕我无法复制你的结果;我按预期得到了结果文件。但如果有帮助的话,也许我的测试参数将帮助您缩小环境中可能的罪魁祸首的范围:
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:
将
WorkingDirectory
设置为energy.dll
和powercfg.exe
所在路径。Set the
WorkingDirectory
to the pathenergy.dll
andpowercfg.exe
is located.