@echo off set PDC=192.168.6.1 set PDCNAME=GATEKEEPER set BDC=192.168.89.1 set BDCNAME=KEYMASTER set mydrive=H: net use %mydrive% /DELETE echo ####### %0 ####### for /f "tokens=2,* delims=:" %%A in ('ipconfig ^| find "Gateway"') do set GATEWAY=%%A set GATEWAY=%GATEWAY:~1% echo GATEWAY=%GATEWAY% if /I %GATEWAY% == %PDC% ( echo using %PDCNAME% as HOMESERVER ... net use %mydrive% \\%PDCNAME%\%USERNAME% ) if /I %GATEWAY% == %BDC% ( echo using %BDCNAME% as HOMESERVER ... net use %mydrive% \\%BDCNAME%\%USERNAME% ) echo ####### %0 #######