Command line 除了可移动磁盘(如果有的话),我们如何在系统中找到固定硬盘的数量

Command line 除了可移动磁盘(如果有的话),我们如何在系统中找到固定硬盘的数量,command-line,command-prompt,Command Line,Command Prompt,除了可移动磁盘(如果有的话),我们如何在系统中找到固定硬盘的数量。 我使用了Msinfo32和diskpart,发现两者都有问题。 Diskpart将可移动磁盘检测为固定磁盘,而Msinfo32在windows xp上的执行时间太长。 下面是我在MSinfo32和diskpart中使用的两个命令。 磁盘部件列表磁盘 “%CommonProgramFiles%\Microsoft Shared\MSInfo\MSInfo 32.EXE”/report disks\u output.txt/cate

除了可移动磁盘(如果有的话),我们如何在系统中找到固定硬盘的数量。 我使用了Msinfo32和diskpart,发现两者都有问题。 Diskpart将可移动磁盘检测为固定磁盘,而Msinfo32在windows xp上的执行时间太长。 下面是我在MSinfo32和diskpart中使用的两个命令。 磁盘部件列表磁盘 “%CommonProgramFiles%\Microsoft Shared\MSInfo\MSInfo 32.EXE”/report disks\u output.txt/categories+component

这方面的任何帮助都会对我们很有帮助。
谢谢。

使用WMI的Powershell:

Get-WmiObject -Query "Select * From Win32_LogicalDisk" | ? { $_.driveType -eq 3 }
如果您只需要固定磁盘的数量:

 @(Get-WmiObject -Query "Select * From Win32_LogicalDisk" | ? { $_.driveType -eq 3 }).count
DriveType属性(数字)对应于逻辑磁盘所代表的磁盘驱动器类型。 值3表示本地磁盘。使用Filter参数仅获取本地磁盘。 添加ComputerName参数以从远程计算机获取结果

Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3"
Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3" -ComputerName pc1,pc2
添加ComputerName参数以从远程计算机获取结果

Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3"
Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3" -ComputerName pc1,pc2
双击“我的电脑”图标,您找到了解决方案:-)(开玩笑)