หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
You can use the Select-Object
cmdlet to create new, custom PowerShell objects that contain
properties selected from the objects you use to create them. Type the following command to create a
new object that includes only the Name and FreeSpace properties of the Win32_LogicalDisk
WMI class:
Get-CimInstance -Class Win32_LogicalDisk |
Select-Object -Property Name, FreeSpace
Name FreeSpace
---- ---------
C: 50664845312
With Select-Object
you can create calculated properties to display FreeSpace in gigabytes
rather than bytes.
Get-CimInstance -Class Win32_LogicalDisk |
Select-Object -Property Name, @{
Label='FreeSpace'
Expression={($_.FreeSpace/1GB).ToString('F2')}
}
Name FreeSpace
---- ---------
C: 47.18
PowerShell