Switch Network Settings With Batch Files - A quick way to change IP, Gateway, DNS

Pages: 1, 2
free web hosting
Free Web Hosting > Computers & Tech > How-To's and Tutorials > Networking

Switch Network Settings With Batch Files - A quick way to change IP, Gateway, DNS

FeedBacker
VISTA UPDATE
Switch Network Settings With Batch Files

Replying to Feedbacker

VISTA UPDATE


I've written the vista update at
Http://samanathon.Com/set-your-ip-address-via-batch-file/

Sorry to link to another site but it saves me typing it all out again!!

-reply by Razzor

Reply

FeedBacker
Doesn\\
Switch Network Settings With Batch Files

Netsh interface ip set address name="LAN-verbinding 4" source=static addr=192.168.0.99 mask=255.255.255.0

Netsh interface ip set address name="LAN-verbinding 4" gateway=192.168.0.100 gwmetric=0

Netsh interface ip set dns name="LAN-verbinding 4" source=static addr=195.130.131.11

Netsh interface ip add dns name = "LAN-verbinding 4" addr = 195.131.131.12

Pause

Hi, I'm having a strange problem. I copy-pasted the code above, made my changes (as you can see) but nothing in the code itself. But he won't set my ip-address and my subnetmask. I have to say I'm working with a laptop with vista. I've had a lot of problems with security and access and stuff. But now he didn't complain about anything, he setted eveything except for ip and subnet. Can anyone help? Ty ^^

-reply by Emmy

Reply

FeedBacker
VISTA UPDATE
Switch Network Settings With Batch Files

- For Vista users only, I've written it here as well-

@ECHO OFF

Set varip=192.168.1.100
Set varsm=255.255.255.0
Set vargw=192.168.1.1
Set vardns1=66.78.202.254
Set vardns2=66.78.210.254

ECHO Setting IP to static
Netsh int ipv4 set address name = �Wireless Network Connection� source = static address = %varip% mask = %varsm%

ECHO Setting IP Address and Subnet Mask
Netsh int ipv4 set address name = �Wireless Network Connection� address = %varip% mask = %varsm% gateway = %vargw% gwmetric = 1

ECHO Setting Primary DNS
Netsh int ip set dns name = �Wireless Network Connection� source = static addr = %vardns1%

ECHO Setting Secondary DNS
Netsh int ip add dns name = �Wireless Network Connection� addr = %vardns2%

ECHO Here are the new settings for %computername%:
Netsh int ip show config

Pause

The change is quite simple�the problem seems to lie in vista�s inability to set the ip to static, and assign the ip address at the same time. So all you have to do is set up the ip to static first, then set the ip�very strange!

Note that your static ip is not displayed when shown, however it is set.

Just change the variables at the beginning to your settings and if needs be, change "wireless network connection" to the name of your connection eg. "LAN-verbinding 4"

-reply by Razzor

 

 

 


Reply

wutske
Thank you very much for looking this up for us wink.gif (and bumping this post, I've been looking for it for a while, but now I don't need it for a few months tongue.gif ).

Reply

FeedBacker
Thanks
Switch Network Settings With Batch Files

Great stuff. Keep up the good work



-reply by Pyous

Reply

FeedBacker
Vista problems
Switch Network Settings With Batch Files

Hiya,

Have you tried running it by right clicking and using 'run as administrator' instead.

It worked for me as I was getting the:

This command needs to be elevated

HTH

-reply by Andy Holland

Reply

FeedBacker
Vista settings
Switch Network Settings With Batch Files

Emmy- that's because you need to type the following into a batch file:

@ECHO OFF

Set varip=192.168.0.99
Set varsm=255.255.255.0
Set vargw=192.168.0.100
Set vardns1=195.131.131.11
Set vardns2=195.131.131.12

ECHO Setting IP to static
Netsh int ipv4 set address name = "LAN-verbinding 4" source = static address = %varip% mask = %varsm%

ECHO Setting IP Address and Subnet Mask
Netsh int ipv4 set address name = "LAN-verbinding 4" address = %varip% mask = %varsm% gateway = %vargw% gwmetric = 1

ECHO Setting Primary DNS
Netsh int ip set dns name = "LAN-verbinding 4" source = static addr = %vardns1%

ECHO Setting Secondary DNS
Netsh int ip add dns name = "LAN-verbinding 4" addr = %vardns2%

ECHO Here are the new settings for %computername%:
Netsh int ip show config

Pause

-reply by Razzor

Reply

iGuest-RAJKUMAR
how to add the one more ip address to a batch file
Switch Network Settings With Batch Files

Hi,


Iam Rajkumar working in crystal granite marble pvt ltd.


Here our lan ip is 192.168.0.1 subnetmask is 255.255.255.0

And internet ip is 10.7.192.81 subnetmask is 255.255.255.240


I want to add the one moreip address to the above mentioned batchfile


I can add the one more dns also but iam not able to add the ip address


Please help me in this scenario



Thnaks and Regards,
Rajkumar.S

-reply by RAJKUMAR

Reply

iGuest-Quang Tran
Thanks
Switch Network Settings With Batch Files

I'm using vista but it didn't work as mentioned above

I tried

Set address name="Wireless Network Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1

And now it works perfectly!

-reply by Quang Tran

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Pages: 1, 2
Recent Queries:-
  1. .bat file dhcp change - 0.00 hr back. (1)
  2. change ip addrees via batch - 0.56 hr back. (1)
  3. bat switch network card - 1.33 hr back. (2)
  4. batch file to change dns ip - 1.43 hr back. (1)
  5. batch network settings - 1.56 hr back. (1)
  6. change ip xp batch - 1.65 hr back. (1)
  7. batch file to change ip address - 2.56 hr back. (6)
  8. netsh problem bat - 3.74 hr back. (1)
  9. batch files for changing the ip - 4.56 hr back. (1)
  10. change gateway with bat file - 4.74 hr back. (1)
  11. netsh interface ip set wins - 5.72 hr back. (1)
  12. ip change batch - 6.31 hr back. (1)
  13. quick ip change - 7.02 hr back. (2)
  14. batch file to change network settings - 7.66 hr back. (1)
Similar Topics

Keywords : switch, network, settings, batch, files, quick, change, ip, gateway, dns

  1. Setting Up A Peer To Peer Network.
    From laying the wires to sharing the printers. (0)
  2. Lock Down Switch Port To Increase Network Security
    Assign the MAC address to each switch port. (0)
    One way to boost network security is to use Cisco's Port Security feature to lock down switch
    ports. A growing challenge facing network administrators is determining how to control who can
    access the organization's internal network—and who can't. For example, can anyone walk into
    your office, plug in a laptop, and access your network? You might argue that the wall jack has no
    connection to a switch, but couldn't someone just pull the Ethernet cable from a working PC and
    connect to the network that way? You might think this an unlikely scenario, but it d....

    1. Looking for switch, network, settings, batch, files, quick, change, ip, gateway, dns






*SIMILAR VIDEOS*
Searching Video's for switch, network, settings, batch, files, quick, change, ip, gateway, dns
advertisement




Switch Network Settings With Batch Files - A quick way to change IP, Gateway, DNS