- PowerShell 教程
- PowerShell - 主頁
- PowerShell - 概述
- PowerShell - 環境設定
- PowerShell - Cmdlet
- PowerShell - 檔案和資料夾
- PowerShell - 日期和計時器
- PowerShell - 檔案 I/O
- PowerShell - 高階 Cmdlet
- PowerShell - 指令碼編寫
- PowerShell - 特殊變數
- PowerShell - 運算子
- PowerShell - 迴圈
- PowerShell - 條件
- PowerShell - 陣列
- PowerShell - 雜湊表
- PowerShell - 正則表示式
- PowerShell - 反引號
- PowerShell - 括號
- PowerShell - 別名
- PowerShell 實用資源
- PowerShell - 快速指南
- PowerShell - 實用資源
- PowerShell - 討論
PowerShell - Format-Wide Cmdlet
cmdlet
Format-Wide cmdlet 可用於將輸出格式化為一個包含每個物件一個屬性的表。
在這些示例中,我們將看到 Format-Wide cmdlet 的實際操作。
示例 1
在此示例中,首先我們有一個檔案 test.txt,位於 D:\temp\test,內容為“Welcome to TutorialsPoint.Com”;test1.txt,內容為“Hello World!”和“Welcome to TutorialsPoint.Com”,分兩行顯示。
在變數中獲取檔案詳細資訊。
$A = Get-ChildItem D:\temp\test\*.txt
使用 Format-Wide cmdlet 獲取檔案詳細資訊。
Format-Wide -InputObject $A
輸出
你可以在 PowerShell 控制檯中看到以下輸出。
Directory: D:\temp\test test.txt test1.txt
示例 2
獲取所需屬性。
在 PowerShell ISE 控制檯中鍵入以下命令
Format-Wide -InputObject $A -Property -Property Length
輸出
你可以在 PowerShell 控制檯中看到以下輸出。
Directory: D:\temp\test 31 44
powershell_advanced_cmdlets.htm
廣告