Board logo

标题: [系统相关] 用assoc关联两个wmic命令 [打印本页]

作者: 小白龙    时间: 前天 22:32     标题: 用assoc关联两个wmic命令

之所以用wmic是因为比powershell执行速度快


我想把下面两行wmic命令通过assoc关联的方式写成一行,
第二行中的xxxx的值实际上是第一行获取的MACAddress的值, 也就是把第1行关联到第2行中, 这样第2行中的xxxx就不断开了,

不想使用for语句, 应该是可以实现的, 但是gpt和ds都搞不定
  1. wmic nic where NetConnectionStatus=2 get MACAddress
  2. wmic nicconfig where "MACAddress=xxxx" get Description,IPAddress,IPSubnet,DefaultIPGateway,DNSServerSearchOrder /format:csv
复制代码

作者: flashercs    时间: 昨天 00:20

  1. wmic nic where "NetConnectionStatus=2" assoc:list /resultclass:Win32_NetworkAdapterConfiguration|findstr /b "Description IPAddress IPSubnet DefaultIPGatewa
  2. y DNSServerSearchOrder"
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2