I introduced conditional processing symbols in tip 0290:
The double ampersand (&&) causes the command following this symbol to run only if the command preceding the symbol is successful.
The double pipe (||) causes the command following this symbol to run only if the command preceding the symbol fails.
Examplespushd \\ServerName\ShareName||goto NoAccess
If the command fails, goto NoAccess will be executed.
pushd \\ServerName\ShareName&&goto popit
@echo The user has no access
REM Do stuff while the current folder is \\ServerName\ShareName
If the command is successful, goto popit is executed, otherwise the error is echoed.