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.
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%