View Single Post
  #7  
Old 02-20-2012, 05:24 AM
aladdin aladdin is offline
Senior Member
 
Join Date: Sep 2008
Posts: 66
Default

[Please DO NOT reply to yourself, use the Edit button to edit your post]

I'm really sorry for that zementmischer.

Yeah I was asking for a batch file which should ask in that particular order but when I googled it then I found my mentioned codes that 100% work.

Technically I was asking for an automatic IP changer in batch form which can either ask IPs/Gateway or these can be defined in a batch file at a particular place. Therefore, I got the latter.

Thanks.

Please consider the following codes:

Code:
@ECHO OFF
 
set varip=10.0.83.88
set varsm=255.255.255.224
set vargw=10.0.83.65
set vardns1=10.0.1.21
set vardns2=10.0.83.66
 
REM ***** You donít need to change anything below this line! ******
 
ECHO This fanciness is brought to you by Saman Sadeghi!

ECHO Setting IP Address and Subnet Mask
netsh int ip set address name = "Local Area Connection" source = static addr = %varip% mask = %varsm%
 
ECHO Setting Gateway
netsh int ip set address name = "Local Area Connection" gateway = %vargw% gwmetric = 

ECHO Setting Primary DNS
netsh int ip set dns name = "Local Area Connection" source = static addr = %vardns1%
 
ECHO Setting Secondary DNS
netsh int ip add dns name = "Local Area Connection" addr = %vardns2%
 
ECHO Here are the new settings for %computername%:
netsh int ip show config
 
pause
Now I want to ask one more thing after running the above codes in batch file.

I go to TCP/IP Properties > Advanced and I found 10.0.83.65 already entered in Default Gateway field.

Now the problem is: I want to add one more gateway in Default Gateway field which is 10.0.83.66 with Metric 50

What additional lines should I add in my batch file in order to do that?

My OS is WIN XP SP3

Thanks in advance.

Last edited by Git : 02-20-2012 at 07:56 AM.
Reply With Quote