Table of Contents

How To Configure Windows IPv4 Settings Using The Command Prompt

DNS Settings

The following is known to work on Windows 7.

Set Primary DNS Server

netsh interface ip set dns "[Adapter Name]" static [Primary DNS IP Address]

OR

netsh interface ip add dns name="[Adapter Name]" [Secondary DNS IP Address] index=1

Set Secondary DNS Server

netsh interface ip add dns name="[Adapter Name]" [Secondary DNS IP Address] index=2

Notes

[Adapter Name] can sometimes be misleading. You should go with whatever the adapter name is under Network Connections. If for some reason the adapter is not showing up in Network Connections but is visible using ipconfig /all then you should use the LAST part of the adapter name.

For instance the line “Ethernet adapter Local Area Connection” actually has the adapter name “Local Area Connection”.
For wireless I've found that “Wireless LAN Adapter Wireless Network Connection” actually has the adapter name “Wireless Network Connection”.