我的电脑(XP Pro SP2 EN)有两块物理网卡和两块虚拟网卡,想用WMIC获取指定IP地址192.168.56.1(这是其中一块虚拟网卡的IP)对应的MAC,在命令行解释器中运行这个命令:- wmic NicConfig where "IPAddress='{"192.168.56.1"}'" get MACAddress /value
复制代码 报错信息为:
Node - Batcher
ERROR:
Code = 0x80041017
Description = Invalid query
Facility = WMI
初步判断是花括号里面的双引号带来的问题。因为运行下面的命令可以正确得到对应的结果(至少说明我的WMIC没问题):
wmic NicConfig where "Index='1'" get MACAddress /value
我尝试过对花括号里面的双引号进行转义,问题依旧:- wmic NicConfig where "IPAddress='{\"192.168.56.1\"}'" get MACAddress /value
- wmic NicConfig where "IPAddress='{^"192.168.56.1^"}'" get MACAddress /value
- wmic NicConfig where "IPAddress='{^"192.168.56.1^"}'" get MACAddress /value
- wmic NicConfig where "IPAddress='{'"192.168.56.1"'}'" get MACAddress /value
- wmic NicConfig where "IPAddress='{""192.168.56.1""}'" get MACAddress /value
- wmic NicConfig where "IPAddress='{'"'192.168.56.1'"'}'" get MACAddress /value
- wmic NicConfig where "IPAddress='{"""192.168.56.1"""}'" get MACAddress /value
复制代码 查看过以下文档,未能找出相关描述:
http://technet.microsoft.com/zh-cn/library/cc784189(WS.10).aspx
到微软中文论坛提问过,暂时没人给出解答:
http://social.microsoft.com/Foru ... 1-91a0-e6ebca613492
请问,当wmic命令的where子句出现这种花括号中有双引号的值时,正确的语法应该怎样写? |