Fork me on GitHub

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>

 

posted @ 2019-03-07 19:24  chenpw  阅读(424)  评论(0)    收藏  举报
View Code