我想写一个像C#的方法
public bool PowershellExists()
{
// Returns true if PowerShell exists on the machine, else false.
}
Run Code Online (Sandbox Code Playgroud)
使用MSDN博客文章检测逻辑进行PowerShell安装,我编写了如下方法:
public bool PowershellExists()
{
string regval = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1", "Install", null).ToString();
if (regval.Equals("1"))
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2966 次 |
| 最近记录: |