Wmic,where关键字后面的所有有效子句

时间:2016-06-10 14:56:33

标签: where wmic clause

我想知道关于wmic命令的关键字后面的所有有效子句。

Wmic nicconfig where DefaultIPGateway!='' get description

上面的命令句子显示错误消息description = invalid query

我怀疑DefaultIPGateway不是有效条款。那么如何获取where关键字背后的所有有效子句。

我做了以下尝试。

Wmic alias get pwhere

1 个答案:

答案 0 :(得分:1)

Full list of the WQL keywords: WQL (SQL for WMI).

Win32_NetworkAdapterConfiguration class:

DefaultIPGateway

Data type: string array
Access type: Read-only
Qualifiers: MappingStrings ("Win32Registry|System\CurrentControlSet\Services|Parameters|DefaultGateway")

Array of IP addresses of default gateways that the computer system uses.

Querying with WQL:

The WMI Query Language (WQL) is a subset of standard American National Standards Institute Structured Query Language (ANSI SQL) with minor semantic changes to support WMI.

Note WQL does not support queries of array datatypes.

Corollary: you cannot constitute a valid WHERE clause to narrow the wmic output by DefaultIPGateway data.
Please read http://ss64.com/nt/wmic.html to see some valid WHERE clause examples used in wmic command.

However, you can still get desired info using find or findstr commands, for instance as follows:

==> Wmic nicconfig get DefaultIPGateway, description | find "{"
{"192.168.11.1"}   Realtek PCIe GBE Family Controller