Jump to content

[HELP] staticIP through .bat


Recommended Posts

Posted

Guys,

I have created two bat files, one is for quick change to DHCP configuration and the other one is for static IP..

DHCP:

netsh interface ip set address "Local Area Connection" dhcp

Static IP:

netsh interface ip set address "Local Area Connection" static 192.168.1.115 255.255.255.0 10.156.1.100 1

StaticIP.bat changes IP address, subnet mask and default gateway..Can I somehow put DNS servers in it also?


Posted
netsh interface ip set address "Local Area Connection" static 192.168.1.115 255.255.255.0 10.156.1.100 1

StaticIP.bat changes IP address, subnet mask and default gateway..Can I somehow put DNS servers in it also?

To set the primary DNS to a static value:

netsh interface ip set dns "Local Area Connection" static 192.168.1.53

To revert it to use DHCP:

netsh interface ip set dns "Local Area Connection" dhcp

Enter "netsh interface ip set dns" to see the usage options.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...