Below and also attached is text for use to check if a drive letter is mapped using WebDrive. If the drive letter is not mapped, WebDrive will then attempt to connect the site.
This may be useful if the drive letter seems to disconnect at times, or simply to ensure the resulting batch file or later commands will succeed by having the letter drive available.
set webdrive="c:\program files\webdriveapp\bin\WebDriveCLI.exe"
set sitename=iiswin10
rem this checks if drive letter W: is defined already or not, use your drive letter here
vol w: >nul 2>nul
if errorlevel 1 (
@echo Drive is not currently connected
goto MAPDRIVE
) else (
echo Drive is already mounted
goto DOWORK
)
:MAPDRIVE
@echo mounting site '%sitename%'
%webdrive% --mount %sitename% --startup --nowait
@rem check process return code, anything other than 0 means it failed to mount
if %ERRORLEVEL% GEQ 1 echo Error mounting drive
echo %ERRORLEVEL%
if %ERRORLEVEL% GEQ 1 goto EXIT
@echo drive mounted successfully
:DOWORK
rem enter your commands here
dir w:\
:EXIT