Using WQL to Limit Results on a String Match
I'm working on developing a WMI query for my application. It needs to find the assigned virtual COM port for a given VID/PID. My query currently looks like this:
"SELECT DeviceID FROM Win32_SerialPort WHERE PNPDeviceID = \"USB\\VID_10C4&PID_EA60\\0001\""
Bas开发者_运维百科ed on my research, it should return "COM8"
. However, I'm getting an empty set.
Are string comparisons valid in WQL? As I recall, SQL allows them, but being a subset, I'm not sure if support for them was carried over.
If necessary, I suppose I can query "SELECT DeviceID,PNPDeviceID FROM Win32_SerialPort"
and then in code parse through the results using string compares, but I'd prefer to limit the results in the query, if possible.
Additionally, I was wondering, if string compares are indeed supported in WQL, are they case sensitive, and/or is there a way to specify case?
Thanks.
I used this (C#):
"Select * From Win32_SerialPort Where PnPDeviceId = \"PCI\\\\VEN_14F1&DEV_2F30&SUBSYS_205D14F1&REV_01\\\\4&1F7DBC9F&0&10F0\""
I needed to escape the backslashes once for WMI's sake and once again for C#'s sake, so I ended with quadruple backslashes in the query.
精彩评论