Reputation: 11
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.
This is what I have so far:
set netsh=wmic nic where "netconnectionid like '%%'" get netconnectionid
for %%i in ("%netsh% | FIND /V 'Net'") do (netsh interface ip set address "%%i" dhcp)
My output is:
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?
Upvotes: 1
Views: 1347
Reputation: 38654
Will this do what you need?
WMIC NICConfig Where "IPEnabled='True' And DHCPEnabled='False'" Call EnableDHCP
Upvotes: 2