如何在Windows下检测CLI中的当前媒体类型? (DVD-RW,BD-R等)

前端之家收集整理的这篇文章主要介绍了如何在Windows下检测CLI中的当前媒体类型? (DVD-RW,BD-R等)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在 Windows下检测CLI中的当前媒体类型? (DVD-RW,BD-R等)

我尝试过使用wmic cdrom get / format:list但没有关于当前媒体类型的信息.

我想检测光盘是CD,DVD,BD,RW,DL ……等.在计算机下的Windows GUI中,我们可以根据光驱显示的图标查看信息.

此外,我找不到可用性和功能值的含义,如果你知道一个文件谈论它,它会很棒.

C:\>wmic cdrom get /format:lis

Availability=3
Capabilities={3,4,7}
CapabilityDescriptions={"Random Access"," Supports writing"," Supports Removable
 Media"}
Caption=HL-DT-ST BD-RE  BH12LS35
CompressionMethod=Unknown
ConfigManagerErrorCode=0
ConfigManagerUserConfig=FALSE
CreationClassName=Win32_CDROMDrive
DefaultBlockSize=
Description=CD-ROM Drive
DeviceID=SCSI\CDROM&VEN_HL-DT-ST&PROD_BD-RE__BH12LS35\4&15828421&amp
;0&050000
Drive=G:
DriveIntegrity=TRUE
ErrorCleared=
ErrorDescription=
ErrorMethodology=
FileSystemFlags=
FileSystemFlagsEx=21757959
Id=G:
InstallDate=
LastErrorCode=
Manufacturer=(Standard CD-ROM drives)
MaxBlockSize=
MaximumComponentLength=254
MaxMediaSize=
MediaLoaded=TRUE
MediaType=DVD Writer
MfrAssignedRevisionLevel=1.00
MinBlockSize=
Name=HL-DT-ST BD-RE  BH12LS35
NeedsCleaning=
NumberOfMediaSupported=
PNPDeviceID=SCSI\CDROM&VEN_HL-DT-ST&PROD_BD-RE__BH12LS35\4&15828421&
amp;0&050000
PowerManagementCapabilities=
PowerManagementSupported=
RevisionLevel=
SCSIBus=5
SCSILogicalUnit=0
SCSIPort=0
SCSITargetId=0
SerialNumber=
Size=39621033984
Status=OK
StatusInfo=
SystemCreationClassName=Win32_ComputerSystem
SystemName=PC
TransferRate=4363,63636363636
VolumeName=XMEN_D1
VolumeSerialNumber=8AF2C6DC

编辑

运行Get-WmiObject Win32_PhysicalMedia |选择*为我提供光驱的以下结果(DVD在驱动器中):

PSComputerName       : PC-JAY
__GENUS              : 2
__CLASS              : Win32_PhysicalMedia
__SUPERCLASS         : CIM_PhysicalMedia
__DYNASTY            : CIM_ManagedSystemElement
__RELPATH            : Win32_PhysicalMedia.Tag="\\\\.\\CDROM0"
__PROPERTY_COUNT     : 23
__DERIVATION         : {CIM_PhysicalMedia,CIM_PhysicalComponent,CIM_PhysicalElement,CIM_ManagedSystemElement}
__SERVER             : PC-JAY
__NAMESPACE          : root\cimv2
__PATH               : \\PC-JAY\root\cimv2:Win32_PhysicalMedia.Tag="\\\\.\\CDROM0"
Capacity             :
Caption              :
CleanerMedia         :
CreationClassName    :
Description          :
HotSwappable         :
InstallDate          :
Manufacturer         :
MediaDescription     :
MediaType            :
Model                :
Name                 :
OtherIdentifyingInfo :
PartNumber           :
PoweredOn            :
Removable            :
Replaceable          :
SerialNumber         :
SKU                  :
Status               :
Tag                  : \\.\CDROM0
Version              :
WriteProtectOn       :
Scope                : System.Management.ManagementScope
Path                 : \\PC-JAY\root\cimv2:Win32_PhysicalMedia.Tag="\\\\.\\CDROM0"
Options              : System.Management.ObjectGetOptions
ClassPath            : \\PC-JAY\root\cimv2:Win32_PhysicalMedia
Properties           : {Capacity,Caption,CleanerMedia,CreationClassName...}
SystemProperties     : {__GENUS,__CLASS,__SUPERCLASS,__DYNASTY...}
Qualifiers           : {dynamic,Locale,provider,UUID}
Site                 :
Container            :

I want to detect if the disc is a CD,DL… etc. In
Windows GUI under Computer we can see the information according to the
icon displayed for the optical drive.

您拥有正确的命令,您寻找的信息位于“标题”字段下.

因此对于:

wmic cdrom get /format:list

在您的示例中,在Caption字段中,您可以看到它是BD-RE(蓝光可刻录)

Caption=HL-DT-ST BD-RE BH12LS35

对于你的第二个问题:

Also,I can’t find the meaning of the Availability and the
Capabilities values,if you know a document talking about it,it would
be great.

有关此类的描述和所有内容可在MSDN上找到:

Win32_CDROMDrive class (Windows)

猜你在找的Windows相关文章