Windows Batch Script: remove trailing slash from a path string








set "a=C:\Users\wx\Downloads\"
if "%a:~-1%"=="\" set "a=%a:~0,-1%"
if "%a:~-1%"=="/" set "a=%a:~0,-1%"
echo %a%



see also




No comments:

Post a Comment