Tuesday, December 16, 2008

Change TCP/IP using command line

This is very helpful for the people they connecting their laptop to their different office. Those office having different TCP/IP setting.

Ex.

Office 1 using static ip address

Office 2 using dynamic ip address.

 

Soln

Create a batchfile for office 1

C:\ip\Office1.bat

netsh interface ip set address name="Wireless Network Connection" static 172.18.11.100 255.255.248.0 172.18.8.1 1

netsh interface ip add dns "Wireless Network Connection" 172.18.9.1

netsh interface ip add dns "Wireless Network Connection" 172.18.9.2

 

Create a batchfile for office 2

C:\ip\Office2.bat

netsh interface ip set address "Wireless Network Connection" dhcp

netsh interface ip set dns "Wireless Network Connection" dhcp

 

right click on cmd.exe run as Administrator

go to c:\ip

execute whichever you want.

Or u can right click on your batch file run as administrator.

 

Similary you can add other details for your TCP/IP connection

For Dns

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

For WINS

netsh interface ip set wins "Local Area Connection" static 192.168.0.10

I hope this is very useful for the people those who are swapping different TCP/IP settings for the connection 


Note : instead of  "Local Area Connection"  or "Wireless Network Connection" change your Network connection name

No comments: