View Single Post
Old 02-20-2012, 08:37 AM
zementmischer zementmischer is offline
Join Date: Apr 2011
Location: Europe
Posts: 43

aladdin, my previous post may sound a bit offensive, but my sole intention was to show you what will happen if you completely ignore replies from other forum members. But rest assured, I'm not upset in any way because of your post

Git, I fully agree that showing someone how to fish is better than just giving them the fish. But guiding someone is a tedious and time-consuming task - especially if the solution is right at your finger tips (I already used such scripts in the past to switch between different intranets).

But back to the topic:
You can also add additional gateways with netsh.
Just add a new variable at the top of your script, eg.
set vargw=
set vargw2=
set vardns1=
and insert the following lines:
ECHO Setting Gateway
netsh int ip set address name="Local Area Connection" gateway=%vargw% gwmetric=1

ECHO Setting Gateway 2
netsh int ip add address name="Local Area Connection" gateway=%vargw2% gwmetric=50

ECHO Setting Primary DNS
netsh int ip set dns name = "Local Area Connection" source = static addr = %vardns1%
Real programmers don't comment their code.
If it was hard to write, it should be hard to read.

Last edited by zementmischer : 02-20-2012 at 08:37 AM. Reason: typo
Reply With Quote