powershell命令示例集
查看powershell 版本
命令一:$host
PS C:\Users\yourname> $host Name : ConsoleHost Version : 4.0 InstanceId : db217dc0-60b5-481a-b9f4-18a759862716 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : zh-CN CurrentUICulture : zh-CN PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace PS C:\Users\yourname>
命令二:Get-Host
PS C:\Users\yourname> Get-Host Name : ConsoleHost Version : 4.0 InstanceId : db217dc0-60b5-481a-b9f4-18a759862716 UI : System.Management.Automation.Internal.Host.InternalHostUserInterface CurrentCulture : zh-CN CurrentUICulture : zh-CN PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace PS C:\Users\yourname>
查看其中某一项值
Get-Host | Select-Object Version
PS C:\Users\yourname> Get-Host | Select-Object Version
Version
-------
4.0
PS C:\Users\yourname>


浙公网安备 33010602011771号