The path is either
Z:\ or
\\SAOSL10005.ALST.NO\TCM, the former being conventional notation, the latter using UNC notation.
You can't use both, but you should be able to parse the
net use output which will co-relate the local mapped drive to the remote device name. That should give you enough information as to whether the Z: drive is mapped and if so mapped correctly.
@echo off
for /f "tokens=2-3" %%i in ('net use ^| find /i "Z:"') do (
if not errorlevel 1 (
set local=%%i
set remote=%%j
goto Mapped
)
)
:UnMapped
.
.
.
goto :eof
:Mapped
echo Local drive: %local%
echo Remote Drive: %remote%
.
.
.
goto :eof
If drive Z: is not mapped, the logic will fall into the :UnMapped label. If drive Z: is mapped, the logic will leave the
for loop and start executing at the :Mapped label. I'll let you fill in the blanks.
The
if statement in the
for loop is written *censored*-backward. Unlike
REXX for example, the
nop instruction does not exist in batch code. NOP (no operation) is a great target for conditional statements as it improves readability.
Dare I say good luck?