- PowerShell 教程
- PowerShell - 主頁
- PowerShell - 概述
- PowerShell - 環境設定
- PowerShell - Cmdlet
- PowerShell - 檔案和資料夾
- PowerShell - 日期和計時器
- PowerShell - 檔案 I/O
- PowerShell - 高階 Cmdlet
- PowerShell - 指令碼編寫
- PowerShell - 特殊變數
- PowerShell - 運算子
- PowerShell - 迴圈
- PowerShell - 條件
- PowerShell - 陣列
- PowerShell - 雜湊表
- PowerShell - Regex
- PowerShell - 反引號
- PowerShell - 括號
- PowerShell - 別名
- PowerShell 有用資源
- PowerShell - 快速指南
- PowerShell - 有用資源
- PowerShell - 討論
Powershell - Select-Object Cmdlet
Cmdlet
Select-Object cmdlet 用於選擇物件或其屬性。
在以下示例中,我們將看到 Select-Object cmdlet 的操作。
示例 1
在此示例中,我們將使用 Process 屬性建立物件。
Get-Process | Select-Object -Property ProcessName, Id, WS -Last 5
輸出
你可以看到以下輸出。
ProcessName Id WS ----------- -- -- UNS 2624 10301440 wininit 624 4935680 winlogon 552 7774208 WLTRYSVC 3080 3608576 WmiPrvSE 1620 11870208
示例 2
在此示例中,我們將選擇陣列的唯一值。
"a","b","c","a","a","a" | Select-Object -Unique
輸出
你可以看到以下輸出。
a b c
powershell_advanced_cmdlets.htm
廣告