Click to Rate and Give Feedback
MSDN
MSDN Library
WMI Reference
WMI and SQL
WQL (SQL for WMI)
WQL Operators
 LIKE Operator
LIKE Operator

The LIKE operator determines whether or not a character string matches a specified pattern. The specified pattern can contain exactly the characters to match, or it can contain meta characters. The following table lists the meta characters.

Character Description
[ ] Any one character within the specified range ([a=f]) or set ([abcdef]).
^ Any one character not within the range ([^a=f]) or set ([^abcdef].)
% Any string of 0 (zero) or more characters. The following example finds all instances where "Win" is found anywhere in the class name: SELECT * FROM meta_class WHERE __Class LIKE "%Win%"
_ (underscore) Any one character. Any literal underscore used in the query string must be escaped by placing it inside [] (square brackets).

Because the underscore is a meta character, if the query target has an underscore, the "[]" escape characters must surround it. For example, you can query for all the classes that have a double underscore in the name.

To locate all classes with a double underscore in the name, you must escape both underscores with [] (square brackets), for example:

 SELECT * FROM meta_class WHERE __CLASS LIKE "%[_][_]%.

Windows 2000 and Windows NT 4.0:  The LIKE operator is not available.

See Also

WQL Operators


Send comments about this topic to Microsoft

Build date: 6/19/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content      
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker