User to work on 2 separate networks

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good day. I have a user who has a laptop who from time to time works on a
separate network / domain. The user wants a simpler way to switch between
domains other than manually configuring the network card. His native domain
is static while the other is DHCP. I have tried a program called Netchange
1.03 but it does not seem to apply the changes. Any ideas on this? It was
suggested that I try a batch file but I've never actually tried writing one
before, so some guidance would be appreciated. Thanks.
 
Nigel Sampath said:
Good day. I have a user who has a laptop who from time to time works on a
separate network / domain. The user wants a simpler way to switch between
domains other than manually configuring the network card. His native domain
is static while the other is DHCP. I have tried a program called Netchange
1.03 but it does not seem to apply the changes. Any ideas on this? It was
suggested that I try a batch file but I've never actually tried writing one
before, so some guidance would be appreciated. Thanks.

Here is a simple example:

@echo off
set loc=
echo.

:again
set /p loc=Please enter O for Office, F for Factory:
if /i "%loc%"=="" goto :eof
if /i "%loc%"=="O" goto office
if /i "%loc%"=="F" goto Factory
goto again

:Office
netsh interface ip set address local static 192.168.1.1 255.255.255.0
goto Exit

:Factory
netsh interface ip set address "Local Area Connection" DHCP

:Exit
ipconfig /all
echo.
echo Please press the Space Bar to close this screen.
pause > nul
 
Hi Pegasus

Tried it out and it seems to be working fine. Question, if I wanted to
include a default gateway, how would i go about doing this for the static
network?
 
Would the following be the correct syntax to add the default ateway?

netsh interface ip set address name="Local Area Connection" static
192.168.0.100 255.255.255.0 192.168.0.1 1

where the last octet is the gateway?
 
You could do it like so:

netsh interface ip set address name="Local Area Connection" gateway=10.0.0.1
gwmetric=1 source=static addr=192.168.0.10 mask=255.255.255.0
 
Back
Top