获取网络接口名称并将所有设置为DHCP批处理脚本 [英] Get Network Interface Names and Set All to DHCP Batch Script
本文介绍了获取网络接口名称并将所有设置为DHCP批处理脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试进行批处理,以获取所有网络接口名称(例如,本地连接",本地连接2")并将其设置为DHCP.
I am trying to make a batch that will get all of the Network Interface names (ex. 'Local Area Connection', 'Local Area Connection 2') and set them to DHCP.
这是我到目前为止所拥有的:
set netsh=wmic nic where "netconnectionid like '%%'" get netconnectionid
for %%i in ("%netsh% | FIND /V 'Net'") do (netsh interface ip set address "%%i" dhcp)
我的输出是:
文件名,目录名称或卷标语法不正确.
The filename, directory name, or volume label syntax is incorrect.
任何人都可以帮助我修复此脚本,或者提出更好的方法来解决此问题吗?
Can anyone assist me in fixing this script, or proposing a better way to go about this please?
推荐答案
这将满足您的需求吗?
WMIC NICConfig Where "IPEnabled='True' And DHCPEnabled='False'" Call EnableDHCP
这篇关于获取网络接口名称并将所有设置为DHCP批处理脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文