Windows 有没有办法使用wmic对哪些卷映射到哪些分区进行反向工程?
问题。。我只能访问wmic。。。我知道。。但需要找出哪个卷对应于哪个分区,哪个分区对应于哪个磁盘。。我知道如何将哪个分区对应于哪个磁盘,因为磁盘id直接出现在wmic查询的结果中。然而,问题的第一部分更加困难。如何关联哪个卷属于哪个分区 有没有办法使用wmic对哪些卷映射到哪些分区进行反向工程 如果是这样,这个查询会是什么样子Windows 有没有办法使用wmic对哪些卷映射到哪些分区进行反向工程?,windows,cmd,wmi,wmic,Windows,Cmd,Wmi,Wmic,问题。。我只能访问wmic。。。我知道。。但需要找出哪个卷对应于哪个分区,哪个分区对应于哪个磁盘。。我知道如何将哪个分区对应于哪个磁盘,因为磁盘id直接出现在wmic查询的结果中。然而,问题的第一部分更加困难。如何关联哪个卷属于哪个分区 有没有办法使用wmic对哪些卷映射到哪些分区进行反向工程 如果是这样,这个查询会是什么样子 wmic logicaldisk get name, volumename 有关更多信息,请使用wmic logicaldisk get/ 有关详细信息,请使用wmic
wmic logicaldisk get name, volumename
有关更多信息,请使用wmic logicaldisk get/
有关详细信息,请使用wmic logicaldisk get/?最简单的方法是从命令提示符下使用
diskpart
:
C:\>diskpart
Microsoft DiskPart version 10.0.10586
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: TIMSPC
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> detail disk
HGST HTS725050A7E630 *(Note: This is the Model of my hard disk)*
Disk ID: 00C942C7
Type : SATA
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(1F02)#ATA(C00T00L00)
Current Read-only State : No
Read-only : No
Boot Disk : Yes
Pagefile Disk : Yes
Hibernation File Disk : No
Crashdump Disk : Yes
Clustered Disk : No
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 464 GB Healthy Boot
Volume 2 NTFS Partition 843 MB Healthy Hidden
DISKPART> exit
Leaving DiskPart...
C:\>
您可以访问命令行,因为您可以访问WMIC,所以此方法应该可以工作
根据以下评论: 不,无法使用WMIC 100%准确地确定特定驱动器上哪个分区对应哪个分区。通过WMI确定此信息的问题在于并非所有驱动器都是基本驱动器。某些磁盘可能包含跨多个驱动器的RAID卷。有些可能是一个完整的硬件实现抽象,如存储阵列(例如,HP ProLiant中的p410i RAID控制器)。此外,还有多种分区方案(eg)。但是WMI独立于其环境。也就是说,它不关心硬件。它只是另一种抽象形式,提供了一个通用的接口模型 要获得您想要的详细程度,需要一个工具,该工具可以像设备的驱动程序那样在较低的级别上进行接口,并希望驱动程序提供您需要的信息。如果它没有,你将看到非常低级别的编程与设备本身接口…基本上创建一个新的驱动程序,提供你想要的信息。但基于您只能访问命令行的限制,Diskpart是您能找到的最接近的预构建工具
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- ------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 465 GB Healthy Boot
Volume 2 D New Volume NTFS Partition 463 GB Healthy
DISKPART> select volume 2
Volume 2 is the selected volume.
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 0 B
* Disk 1 Online 465 GB 2049 MB
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
* Partition 1 Primary 463 GB 1024 KB
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- ------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 465 GB Healthy Boot
* Volume 2 D New Volume NTFS Partition 463 GB Healthy
DISKPART>
注意到星号了吗?这些表示活动磁盘、分区和卷。虽然这些不是让用户100%知道他们正在处理哪个分区所需的ID,但您至少可以清楚地看到卷2(D:)位于磁盘1的分区1上
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 465 GB Healthy Boot
Volume 2 D New Volume NTFS Partition 463 GB Healthy
Volume 3 RAW Partition 2048 MB Healthy
DISKPART> select volume 3
Volume 3 is the selected volume.
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 465 GB Healthy Boot
Volume 2 D New Volume NTFS Partition 463 GB Healthy
* Volume 3 RAW Partition 2048 MB Healthy
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 463 GB 1024 KB
* Partition 2 Primary 2048 MB 463 GB
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 0 B
* Disk 1 Online 465 GB 1024 KB
在示例数据中,可以枚举磁盘、卷和分区。通过循环遍历每个对象并选择它,您可以创建一个映射,该映射表示哪个卷位于哪个分区上,哪个驱动器包含该分区。Diskpart可能无法在100%的时间内以100%的精度提供100%所需的数据,但它是最接近您的命令行工具,可以满足您的目标。最简单的方法是使用命令提示符下的
Diskpart
:
C:\>diskpart
Microsoft DiskPart version 10.0.10586
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: TIMSPC
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> detail disk
HGST HTS725050A7E630 *(Note: This is the Model of my hard disk)*
Disk ID: 00C942C7
Type : SATA
Status : Online
Path : 0
Target : 0
LUN ID : 0
Location Path : PCIROOT(0)#PCI(1F02)#ATA(C00T00L00)
Current Read-only State : No
Read-only : No
Boot Disk : Yes
Pagefile Disk : Yes
Hibernation File Disk : No
Crashdump Disk : Yes
Clustered Disk : No
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 464 GB Healthy Boot
Volume 2 NTFS Partition 843 MB Healthy Hidden
DISKPART> exit
Leaving DiskPart...
C:\>
您可以访问命令行,因为您可以访问WMIC,所以此方法应该可以工作
根据以下评论: 不,无法使用WMIC 100%准确地确定特定驱动器上哪个分区对应哪个分区。通过WMI确定此信息的问题在于并非所有驱动器都是基本驱动器。某些磁盘可能包含跨多个驱动器的RAID卷。有些可能是一个完整的硬件实现抽象,如存储阵列(例如,HP ProLiant中的p410i RAID控制器)。此外,还有多种分区方案(eg)。但是WMI独立于其环境。也就是说,它不关心硬件。它只是另一种抽象形式,提供了一个通用的接口模型 要获得您想要的详细程度,需要一个工具,该工具可以像设备的驱动程序那样在较低的级别上进行接口,并希望驱动程序提供您需要的信息。如果它没有,你将看到非常低级别的编程与设备本身接口…基本上创建一个新的驱动程序,提供你想要的信息。但基于您只能访问命令行的限制,Diskpart是您能找到的最接近的预构建工具
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- ------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 465 GB Healthy Boot
Volume 2 D New Volume NTFS Partition 463 GB Healthy
DISKPART> select volume 2
Volume 2 is the selected volume.
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 0 B
* Disk 1 Online 465 GB 2049 MB
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
* Partition 1 Primary 463 GB 1024 KB
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- ------
Volume 0 System NTFS Partition 350 MB Healthy System
Volume 1 C OSDisk NTFS Partition 465 GB Healthy Boot
* Volume 2 D New Volume NTFS Partition 463 GB Healthy
DISKPART>
注意到星号了吗?这些表示活动磁盘、分区和卷。虽然这些不是让用户100%知道他们正在处理哪个分区所需的ID,但您至少可以清楚地看到卷2(D:)位于磁盘1的分区1上