Select-Object用法
展开 modules 属性的详细信息
get-process |? {$_.processname -eq "cmd"}|select -ExpandProperty modules
不显示某个属性,当参数中也包括 -property 时,-excludeproperty 才有效
get-process |? {$_.processname -eq "cmd"}|select -property id,processname -ExcludeProperty id
"a","b","c","a","a","a" | select-object -unique #选择唯一值,去掉重复值
get-content servers.txt | select-object -skip 1 #跳过第一个
get-process | select-object -property ProcessName,@{Name="Start Day"; Expression = {$_.StartTime.DayOfWeek}} #构造Hash表