列出Powershell中的所有设备,分区和卷

wis*_*shi 43 powershell list device

我有多个卷(现在几乎每个人都有):在Windows上,它们最终指定为C:,D:等等.如何在带有Powershell的"ls/mnt /"的Unix机器上列出这些内容?

bdu*_*kes 68

要获取所有文件系统驱动器,可以使用以下命令:

gdr -PSProvider 'FileSystem'
Run Code Online (Sandbox Code Playgroud)

gdr是别名Get-PSDrive,其中包括注册表的所有"虚拟驱动器"等.

  • @BaconBits我已经更新了答案,以反映您的更好选择。为了后代,我最初有`gdr | 其中{$ _。Provider.Name -eq“ FileSystem”}` (2认同)

小智 17

获取批量

你会得到:DriveLetter,FileSystemLabel,FileSystem,DriveType,HealthStatus,SizeRemaining和Size

  • Get-Volume对运行Powershell 5.1的我有用。也许他们在最近几年/最近的更新中制定了此标准。这个答案应该引起更多关注。 (2认同)

小智 8

在Windows Powershell上:

Get-PSDrive 
[System.IO.DriveInfo]::getdrives()
wmic diskdrive
wmic volume
Run Code Online (Sandbox Code Playgroud)

实用程序dskwipe:http://smithii.com/dskwipe

dskwipe.exe -l
Run Code Online (Sandbox Code Playgroud)


eph*_*ent 5

首先,在您使用的 Unix 上mount,不是ls /mnt:很多东西都没有安装在/mnt.

无论如何,有mountvolDOS 命令,它继续在 Powershell 中工作,还有特定于 Powershell 的Get-PSDrive.


Mwi*_*iza 5

运行命令:

Get-PsDrive -PsProvider FileSystem
Run Code Online (Sandbox Code Playgroud)

欲了解更多信息,请参阅: