I use a handy subroutine to build paths:
@setlocal ENABLEEXTENSIONS
@set prompt=$G
set _var1=\Dir1\\\\Dir2\
set _var2=\Dir3\Dir4
set _var3=Relative\\\\Path
set _var4="QuotedPath\\\\Path%"
call :SetFQDP _var5 %_var1%\%_var2%
set _var5
call :SetFQDP _var5 %_var3%
set _var5
call :SetFQDP _var5 %_var4%
set _var5
@exit /b 0
@rem Set specified variable to a fully qualified drive\path name with no
@rem redundant backslashes. Convert all forward slashes to backslashes.
@rem Removes quotes.
:SetFQDP
@set %1=%~f2
@exit /b %_ERROR_SUCCESS_%
Produces:
> test
>set _var1=\Dir1\\\\Dir2\
>set _var2=\Dir3\Dir4
>set _var3=Relative\\\\Path
>set _var4="QuotedPath\\\\Path"
>call :SetFQDP _var5 \Dir1\\\\Dir2\\\Dir3\Dir4
>set _var5
_var5=D:\Dir1\Dir2\Dir3\Dir4
>call :SetFQDP _var5 Relative\\\\Path
>set _var5
_var5=D:\TMP\Joseph\Relative\Path
>call :SetFQDP _var5 "QuotedPath\\\\Path"
>set _var5
_var5=D:\TMP\Joseph\QuotedPath\Path
Note that if the drive letter is not supplied the current drive is used. If a final trailing slash is passed in, it will be preserved. The fully qualified path of the current directory is always prefixed to any relative path (doesn't start with '/' or '\'). The resulting path does not have to exist, so you'll either have to create it or test for its existence.
Pulling it all together for you:
@call :SetFQDP strDestPath=%LIBDIR%"\Libraries\python\win\"
@call :SetFQDP strPythonZipSourcePath=%CTEDIR%"\Libraries\python\win\Python27.zip
Call :UnZipFile %strDestPath% %strPythonZipSourcePath%
exit /b
@rem Set specified variable to a fully qualified drive\path name with no
@rem redundant backslashes. Convert all forward slashes to backslashes.
@rem Removes quotes.
:SetFQDP
@set %1=%~f2
@exit /b %_ERROR_SUCCESS_%
set strPythonZipSourcePath=%strPythonZipSourcePath:\\=\%to remove all double backslashs\\with a single\.Echo %strDestPath:\\=\%. Seeset /?.forloop and the~fmodifier:for %%I in ("D:\WinLibraryes\\Libraries\.\python\wrong\..\\win\") do @echo/%~fI. Let me recommend not to do string manipulation on paths as there could be special cases you might forget (e. g., do not blindly remove trailing\, because you might have a root path likeD:`; regard thatD:` is not the same as `D:`...set "strDestPath=%LIBDIR%\Libraries\python\win\", so the variable values do not contain any quotes, and use quotes when reading the variables, likeecho "%strDestPath%"...