我有多个卷(作为几乎每个人都如今):在窗户,他们最终指定为C:D:等等。我怎么这些列表所有喜欢上的一台Unix机器与"ls/产妇和新生儿破伤风/"with advanced?

有帮助吗?

解决方案

要得到所有的文件系统驱动器,可以使用下面的命令:

gdr -PSProvider 'FileSystem'

gdr Get-PSDrive 一个别名,其中包括所有的对于注册表中的“虚拟驱动器”等。

其他提示

GET-量

您将得到: 驱动器号,FileSystemLabel,文件系统的DriveType,HealthStatus,SizeRemaining和尺寸

在视窗Powershell的:

Get-PSDrive 
[System.IO.DriveInfo]::getdrives()
wmic diskdrive
wmic volume

另外的效用dskwipe: http://smithii.com/dskwipe

dskwipe.exe -l

首先,在Unix使用mount,不ls /mnt:许多事情不是安装在/mnt

总之,还有的mountvol DOS命令,该命令继续Powershell的工作,并且有特定的Powershell的-Get-PSDrive

这是很老,但我发现以下值得注意:

PS N:\> (measure-command {Get-WmiObject -Class Win32_LogicalDisk|select -property deviceid|%{$_.deviceid}|out-host}).totalmilliseconds
...
928.7403
PS N:\> (measure-command {gdr -psprovider 'filesystem'|%{$_.name}|out-host}).totalmilliseconds
...
169.474

如果没有过滤特性,我的测试系统上,4319.4196ms到1777.7237ms。除非我需要一个PS-Drive对象回来了,我会坚持使用WMI。

编辑:  我认为,我们有一个赢家: PS N:>(小节 - 命令{[System.IO.DriveInfo] :: getdrives()|%{$ _名称} |出主机。})至talmilliseconds。 110.9819

虽然这不是'PowerShell中的特殊......你可以很容易地列出使用DISKPART驱动器和分区列表容积

PS C:\Dev> diskpart

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: Box

DISKPART> list volume

Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
----------  ---  -----------  -----  ----------  -------  ---------  --------
Volume 0     D                       DVD-ROM         0 B  No Media
Volume 1         C = System   NTFS   Partition    100 MB  Healthy    System
Volume 2     G   C = Box      NTFS   Partition    244 GB  Healthy    Boot
Volume 3     H   D = Data     NTFS   Partition    687 GB  Healthy
Volume 4     E   System Rese  NTFS   Partition    100 MB  Healthy

我们有每驱动多个卷(一些被安装在子目录中的驱动器上)。这段代码显示挂载点和卷标的列表。很明显,你还可以提取空闲空间等等:

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

运行命令:

Get-PsDrive -PsProvider FileSystem

更多的信息见:

“替代文字”

PS功能:> 获取-PSDrive来

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top