Can you set the same static ip address/netmask (no gateway) on multiple interfaces using netsh?

0

I don't have an environment where I can test this currently. In Windows 7, can you set the same static ip address/netmask (no gateway) on multiple interfaces using netsh from command line? Or will it give me some sort of error? I ask because I need to change two interfaces (flip them essentially) and don't want to disable one in between changing the other.

For example, if I have the following:

Local Area Connection 1: 192.168.1.123 255.255.0.0

Local Area Connection 2: 192.168.1.234 255.255.0.0

And I want to flip them like so

netsh interface ipv4 set address name="Local Area Connection 1" static 192.168.1.234 255.255.0.0

netsh interface ipv4 set address name="Local Area Connection 2" static 192.168.1.123 255.255.0.0

My hope is that it will perform both commands, one after the other, successfully.

sqenixs

Posted 2017-01-06T14:50:27.503

Reputation: 1

Answers

0

Yes you can do this. You need to use a FOR loop on the command line:

FOR /L %variable IN (start,step,end) DO command

sqenixs

Posted 2017-01-06T14:50:27.503

Reputation: 1