Hello,
This looks like a possible batch tool defect. Usually the pushd "%~dp0" does the trick (maps the drive temporarily and cds to it) for UNC/network paths - which is part of the batch script code - but UNC + folders with spaces = a more complicated scenario
I was able to reproduce the issue in-house, and the following seems to work for me (assumes the setup.exe is in the same folder as the batch script)
If you want to give it a try, copy the following text to the top of the script (right below the @echo off) line. For other changes see the highlights in the screen-shots and the code snippets further below.
:Get the current folder
set CURRENTDIR=%~dp0
:Remove the trailing slash (causes "net use" to fail)
IF %CURRENTDIR:~-1%==\ SET CURRENTDIR=%CURRENTDIR:~0,-1%
:Map folder (not peristent) to first available letter. Normally pushd would be used but it maps to the first
:folder in the path and subsequent folders also have spaces so it won't resolve the problem
net use * "%CURRENTDIR%" /persistent:no
:Find which drive letter the mapping is under
for /f "tokens=2" %%a in ('net use ^| find "%CURRENTDIR%"') do set TEMPMAP=%%a
echo %TEMPMAP% has been mapped to "%CURRENTDIR%"
Top half of script:
Code snippets:
PUSHD "%TEMPMAP%\"
SET MIPPATH=%CD%setup.exe
VER | FINDSTR /IL "6." > NUL
IF %ERRORLEVEL% NEQ 0 SET MIPPATH=%CD%setup.exe
echo MIPPATH is set to %MIPPATH%
SET Self=%CD%%~n0%~x0
REM SET Self=%~f0
REM PUSHD "%~dp0"
Bottom half of script:
Code snippets:
:Remove the temporary drive mapping (although a reboot will also clear it since it is not persistent)
:Place this at or near the bottom of the batch script
net use %TEMPMAP% /DELETE /YES