wmi - How do I escape comma in WMIC inside like string -
i wish able run query following:
wmic path win32_service "displayname 'foobarservice % (x, y)'" *
but, doesn't work because of comma inside string. error "invalid verb." tried escaping backslash, , tried escaping using brackets underscores meant escaped, , both resulted in "invalid verb." error.
as less-than-ideal workaround, can replace commas underscores, , works, underscore match single character rather comma, i'd rather find way escape commas.
is there way escape comma in example?
one way have found include comma in like
clause place entire where
expression in parentheses. unfortunately, found means cannot include close paren in string @ same time (but open paren okay). experimented /trace:on
option see going on under covers little bit , helped me find couple things program accepts:
here example got work comma, apparently cannot contain close paren:
c:\> wmic /trace:on path win32_service (description '%(%, %') displayname
and here example got work both open , close parentheses, apparently cannot contain comma (obviously, quite similar original example):
c:\> wmic /trace:on path win32_service "description '%(tapi)%'" displayname
it seems parser isn't complex enough handle these cases, tracing on, can see wmi win32 functions uses, maybe write own program uses functions directly. think iwbemservices::execquery
capable of you're looking do.
Comments
Post a Comment