Q: Batch IF IP address is 192.168.1."" then I want to create a batch file to map drives dependent on the location where the user logs in. I created some batch files, but they are not working properly. The user only gets the mapped drives from the first location, no matter where they log in. Only the batch file with the menu is working, I want it to automatically update. Here are the batch files. Hopefully you could help me.
@ECHO OFF
ipconfig    | find /i "192.168.1." > NUL
IF ERRORLEVEL == 0 GOTO Server1
ipconfig    | find /i "192.168.2." > NUL
IF ERRORLEVEL == 0 GOTO Server2
ECHO Ip adres conflict
PAUSE
GOTO END
:Server1
net use H: \\Server1\Users$\%username%
net use S: \\Server1\Folder
GOTO END
:Server2
net use H: \\Server2\Users$\%username%
net use S: \\Server2\Folder
GOTO END
:END


@ECHO OFF
ipconfig | find /c "192.168.1."> NUL2>NUL
IF ERRORLEVEL==0 GOTO Server1
ipconfig | find /c "192.168.2."> NUL2>NUL
IF ERRORLEVEL==0 GOTO Server2
ECHO Ip adres conflict
PAUSE
GOTO END
:Server1
net use H: \\Server1\Users$\%username%
net use S: \\Server1\Folder
GOTO END
:zwaluwhoeve
net use H: \\Server2\Users$\%username%
net use S: \\Server2\Folder
GOTO END
:END

The problem is that this code is not working. It only maps the drives from one location. Hopefully you can help me. PS: sorry for the bad english.   

A: You can't access the error level with ERRORLEVEL but with %ERRORLEVEL%! In your code you are comparing the string ERRORLEVEL with 0. This is obviously always false. Adding % should work.
