No doubt a boring old school trick for the Powershell users among you, so, like, over batch files but handy in case of emergency:
If you supply a quoted parameter to a batch file (e.g. a directory path) and later need to remove the quotes to accommodate additional manipulation, handle the incoming parameter as %~1 instead of %1.
To remove a trailing slash, do this:
IF "%SOLUTION_DIR:~-1%"=="\" SET SOLUTION_DIR=%SOLUTION_DIR:~0,-1%