VBScript根据盘符找设备名的代码
2017年03月15日
复制代码 代码如下:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & " oot\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"associators of {win32_logicaldisk.deviceid='G:'} WHERE ResultClass=Win32_DiskPartition")
For Each objItem in colItems
TargetIndex = objItem.DiskIndex
Set Items = objWMIService.ExecQuery( _
"SELECT * FROM Win32_DiskDrive Where DeviceID Like '%" & objItem.DiskIndex & "'",,48)
For Each Item in Items
Wscript.Echo "Model: " & Item.Model
Next
Next
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & " oot\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"associators of {win32_logicaldisk.deviceid='G:'} WHERE ResultClass=Win32_DiskPartition")
For Each objItem in colItems
TargetIndex = objItem.DiskIndex
Set Items = objWMIService.ExecQuery( _
"SELECT * FROM Win32_DiskDrive Where DeviceID Like '%" & objItem.DiskIndex & "'",,48)
For Each Item in Items
Wscript.Echo "Model: " & Item.Model
Next
Next
相关阅读
-
工商银行喜结良缘金条30克价格今天多少一克(2024年05月03日)
-
工商银行筑梦中华金条100克价格今天多少一克(2024年05月03日)
-
2024版熊猫纪念币150克精制金币现在市场价是多少(2024年05月03日)
-
2024版3克熊猫金币价格(2024年05月03日)
-
周生生铂金多少钱一克(2024年05月03日)参考价格
-
北京菜百铂金多少钱一克(2024年05月03日)参考价格
-
北京菜百黄金价格今天多少一克(2024年05月03日)
-
上海老庙铂金多少钱一克(2024年05月03日)参考价格
-
黄金9995价格多少钱一克(2024年05月03日)
-
周大福黄金价格今天多少一克(2024年05月03日)