hello world

命令提示符下的WQL

WQL就是英文WMI Query Language的缩写,就是说wmic这个命令支持简单的一些SQL查询,我们以实例来讲解他的部分用法,这个命令过于强大,因此以下只是该命令的冰山一角。

列出本地连接的简要信息

C:\>wmic nicconfig list brief
DefaultIPGateway Description DHCPEnabled DNSDomain Index IPAddress ServiceName
Microsoft Kernel Debug Network Adapter TRUE 0 kdnic
{"192.168.3.1"} Intel(R) Wireless-N 7265 TRUE 1 {"192.168.3.227"} Netwtw04
Intel(R) Ethernet Connection (3) I218-LM TRUE 2 e1iexpress
Microsoft Wi-Fi Direct Virtual Adapter TRUE 3 vwifimp
Microsoft ISATAP Adapter FALSE 4 tunnel
Microsoft Teredo Tunneling Adapter FALSE 5 tunnel
Bluetooth Device (RFCOMM Protocol TDI) FALSE 6 RFCOMM
Bluetooth Device (Personal Area Network) TRUE 7 BthPan
TAP-Win32 Adapter V9 TRUE 8 {"2.0.1.4"} tap0901
TAP-Win32 Adapter V9 TRUE 10 tap0901
Microsoft ISATAP Adapter FALSE 11 tunnel
Microsoft 6to4 Adapter FALSE 12 tunnel
VMware Virtual Ethernet Adapter for VMnet1 FALSE 13 {"192.168.246.1"} VMnetAdapter
Microsoft ISATAP Adapter FALSE 14 tunnel
VMware Virtual Ethernet Adapter for VMnet8 FALSE 15 {"192.168.47.1"} VMnetAdapter
Microsoft ISATAP Adapter FALSE 16 tunnel
Microsoft ISATAP Adapter FALSE 17 tunnel

承上,列出IP地址是通过DHCP获取的本地连接简要信息

C:\>wmic nicconfig where DHCPEnabled='TRUE' list brief
DefaultIPGateway Description DHCPEnabled DNSDomain Index IPAddress ServiceName
Microsoft Kernel Debug Network Adapter TRUE 0 kdnic
{"192.168.3.1"} Intel(R) Wireless-N 7265 TRUE 1 {"192.168.3.227"} Netwtw04
Intel(R) Ethernet Connection (3) I218-LM TRUE 2 e1iexpress
Microsoft Wi-Fi Direct Virtual Adapter TRUE 3 vwifimp
Bluetooth Device (Personal Area Network) TRUE 7 BthPan
TAP-Win32 Adapter V9 TRUE 8 {"2.0.1.4"} tap0901
TAP-Win32 Adapter V9 TRUE 10 tap0901

承上,列出本地连接显示已连接的本地连接简要信息,而不是已断开的本地连接

C:\>wmic nicconfig where (DHCPEnabled='TRUE' and IPEnabled='TRUE') list brief
DefaultIPGateway Description DHCPEnabled DNSDomain Index IPAddress ServiceName
{"192.168.3.1"} Intel(R) Wireless-N 7265 TRUE 1 {"192.168.3.227"} Netwtw04
TAP-Win32 Adapter V9 TRUE 8 {"2.0.1.4"} tap0901

承上,列出描述信息不带win32字样的本地连接简要信息

C:\>wmic nicconfig where (DHCPEnabled='TRUE' and IPEnabled='TRUE' and not Description like '%win32%') list brief
DefaultIPGateway Description DHCPEnabled DNSDomain Index IPAddress ServiceName
{"192.168.3.1"} Intel(R) Wireless-N 7265 TRUE 1 {"192.168.3.227"} Netwtw04

承上,我只要列出IP地址和网关,其他的不要

C:\>wmic nicconfig where (DHCPEnabled='TRUE' and IPEnabled='TRUE' and not Description like '%win32%') get IPAddress,DefaultIPGateway
DefaultIPGateway IPAddress
{"192.168.3.1"} {"192.168.3.227"}

 

小朋友们,你们都学会了吗?我们再来一遍吧!!!

 技术交流群:70539804

posted @ 2016-08-03 13:10  浩天四哥  阅读(860)  评论(0编辑  收藏  举报