Reliable way to check if two variables in CMD shell point to the same folder
3 answers
You can normalize variables with a little function.
set d1=C:\
set d2=C:\Windows\..
call :normalize d1
call :normalize d2
if "%d1%"=="%d2%" (echo true) else (echo false)
exit /b
:normalize
setlocal EnableDelayedExpansion
for /F "delims=" %%M in ("!%1!") do (
endlocal
set "%1=%%~dpM"
)
exit /b
+5
source to share