List all devices, partitions and volumes in Powershell

后端 未结 9 837
时光取名叫无心
时光取名叫无心 2021-01-30 19:53

I have multiple volumes (as nearly everybody nowadays): on Windows they end up specified as C:, D: and so on. How do I list these all like on a Unix machine with \"ls /mnt/\" wi

9条回答
  •  滥情空心
    2021-01-30 20:49

    We have multiple volumes per drive (some are mounted on subdirectories on the drive). This code shows a list of the mount points and volume labels. Obviously you can also extract free space and so on:

    gwmi win32_volume|where-object {$_.filesystem -match "ntfs"}|sort {$_.name} |foreach-object {
      echo "$(echo $_.name) [$(echo $_.label)]"
    }
    

提交回复
热议问题