TechArena Community

TechArena Community (
-   Software Development (
-   -   I want to create a TCP/IP Batch file (

aladdin 14-02-2012 06:30 PM

I want to create a TCP/IP Batch file
Hello everybody !!!

I need to create a batch file where I can change my TCP/IP settings, i.e., IP addresses.

When I run that batch file it should ask in the following order one by one:

1. IP Address
2. Subnet Mask
3. Default gateway
4. Preferred DNS
5. Alternate DNS

My OS is WinXP SP3

I read the following thread but it couldn't solve my problem.

I want to ask that when I copied the commands in notepad from the above link and ran the batch file then it asks LAN name. But I tried almost all names like Local Area Connection or LAN but it said "Local Area Connection, Lan" is wrongly specified or something like this. I want to know the name of LAN command.

So I want a batch file and also the name of LAN which I should enter during running of batch file.

Please someone help me.

my email:


Janosô 14-02-2012 11:59 PM

Re: I want to create a TCP/IP Batch file
Check the below examples:


3.set varip=
4.set varsm=
5.set vargw=
6.set vardns1=
7.set vardns2=
10.REM ***** You donít need to change anything below this line! ******
12.ECHO This fanciness is brought to you by Saman Sadeghi!
13.ECHO Setting IP Address and Subnet Mask
14.netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%
16.ECHO Setting Gateway
17.netsh int ip set address name = "Local Area Connection" gateway = %vargw% gwmetric = 1
19.ECHO Setting Primary DNS
20.netsh int ip set dns name = "Local Area Connection" source = static addr = %vardns1%
22.ECHO Setting Secondary DNS
23.netsh int ip add dns name = "Local Area Connection" addr = %vardns2%
25.ECHO Setting Internet Explorer Homepage to %varhome%
26.reg add "hkcusoftwaremicrosoftinternet explorermain" /v "Start Page" /d "%varhome%" /f
28.ECHO Here are the new settings for %computername%:
29.netsh int ip show config

All times are GMT +5.5. The time now is 08:35 AM.