存在,我有一个查询来检测USB设备. ---------------------------- SELECT * FROM __InstanceOperationEvent在1个位置内TargetInstance ISA'Win32_PnPEntity'和TargetInstance.Service ='USBSTOR' -------------------------- - 我从中获得USB的PnPDevice ID.现在,我还需要它的驱动器名称或磁盘号,它是Win32_DiskDrive的详细信息.我想知道USB显示为哪个名称(D:/E:..).主要是,我认为我的问题与Win32_PnPEntity和Win32_DiskDrive有关.对于相同的USB,在两种情况下显示的PnPDeviceID均不同. 注意:可以连接2个以上的USB,因此我无法判断是Win32_DiskDrive中的USB驱动器. ="h2_lin">解决方案
您好,Vipink85, 基于我的理解,您可以使用 GetDrivers 方法,该方法在" System :: IO :: DriverInfo "检索计算机上所有逻辑驱动器的驱动器名称.有关更多信息,请参见带有以下链接的该线程: social.msdn.microsoft/forums/en-US/vcgeneral/thread/f632190f-b77b-4646-8a18-e63c7b7425c0 如果我误解了您,或者您有任何问题,请告诉我. 最好的问候,南希
Presenlty, I have a query to detect USB device. ---------------------------- SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_PnPEntity' and TargetInstance.Service='USBSTOR' ---------------------------- I get USB's PnPDevice ID from it. Now I also want its drive name or disk number which is a Win32_DiskDrive detail. I wanted to know the USB is displayed as which name(D:/E:..). Mainly, I think my problem is relating Win32_PnPEntity and Win32_DiskDrive. The PnPDeviceID displayed in both the cases are different for same USB. Note: There can be more than 2 USB's attached so I cannot juct check which is USB drive from Win32_DiskDrive.
解决方案 Hi Vipink85,Based on my understanding, you could use GetDrivers method which defined in "System::IO::DriverInfo" to retrieves the drive names of all logical drives on a computer. For more information, please see this thread with following link:social.msdn.microsoft/forums/en-US/vcgeneral/thread/f632190f-b77b-4646-8a18-e63c7b7425c0If I misunderstood you, or you have any problems, please let me know.Best Regards,Nancy更多推荐
与Win32
发布评论