我正在使用这段C#代码通过PowerShell读取我的已安装程序。
我需要它通过PowerShell读取x64和x86注册表,我该如何做?
是否有一种重定向的方式?或者可能在x64中运行PowerShell,然后在x86中运行?
我需要它通过PowerShell读取x64和x86注册表,我该如何做?
是否有一种重定向的方式?或者可能在x64中运行PowerShell,然后在x86中运行?
public void conf() {
process p1 = new Process();
ProcessStartInfo psi1 = new ProcessStartInfo("powershell", "Get-ItemProperty HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\* | Select-Object DisplayName");
psi1.RedirectStandardOutput = true;
psi1.CreateNoWindow = true;
p1.StartInfo = psi1;
p1.StartInfo.UseShellExecute = false;
p1.StartInfo.Verb = "runas";
p1.Start();
string output = p1.StandardOutput.ReadToEnd();
Console.WriteLine(output);
p1.WaitForExit(400);
}
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\
键不受x64重定向的影响。那个PowerShell命令应该列出x64和x86程序。问题到底是什么?你只看到x64还是只看到x86程序? - Jcl