如何使用C#检查PowerShell是否已安装
发布时间:2020-12-16 02:01:27 所属栏目:百科 来源:网络整理
导读:参见英文答案 Determine installed PowerShell version????????????????????????????????????17个 我想写一个 C#方法 public bool PowershellExists(){ // Returns true if PowerShell exists on the machine,else false.} 解决方法 使用MSDN博客文章 Detect
参见英文答案 >
Determine installed PowerShell version????????????????????????????????????17个
我想写一个 C#方法 public bool PowershellExists() { // Returns true if PowerShell exists on the machine,else false. } 解决方法
使用MSDN博客文章
Detection logic for PowerShell installation,我编写了如下方法:
public bool PowershellExists() { string regval = Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1","Install",null).ToString(); if (regval.Equals("1")) return true; else return false; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |