Вариант 1:
Код:
@Echo Off
For /F "Tokens=1 Skip=1 Delims={,} " %%i In ('WMIC NICCONFIG Where IPEnabled^=TRUE Get IPAddress') Do GoTo :%%~i
:Continue
Rem Тут
Rem продолжение
Rem батника
Exit /B 0
:192.168.0.1
Net Use X: \\SRV01\Share1
Net Use Y: \\SRV02\Share2
GoTo :Continue
:192.168.0.2
Net Use X: \\SRV01\Share1
Net Use Y: \\SRV03\Share3
GoTo :Continue
:192.168.0.3
Net Use X: \\SRV03\Share3
Net Use Y: \\SRV04\Share4
GoTo :Continue
Вариант 2:
Код:
@Echo Off
Set $G1=192.168.0.1 192.168.0.2 192.168.0.3
Set $G2=192.168.0.4 192.168.0.5 192.168.0.6
Set $G3=192.168.0.7 192.168.0.8 192.168.0.9
For /F "Tokens=1 Skip=1 Delims={,} " %%i In ('WMIC NICCONFIG Where IPEnabled^=TRUE Get IPAddress') Do Set $IP=%%~i& GoTo Continue
:Continue
For /F "Tokens=1,2 Delims==" %%i In ('Set $G') Do For %%a In (%%j) Do If "%$IP%"=="%%a" Call :%%i
Exit /B 0
:$G1
Net Use X: \\SRV01\Share1
Net Use Y: \\SRV02\Share2
GoTo :EOF
:$G2
Net Use X: \\SRV01\Share1
Net Use Y: \\SRV03\Share3
GoTo :EOF
:$G3
Net Use X: \\SRV03\Share3
Net Use Y: \\SRV04\Share4
GoTo :EOF