Remove Trailing Slash From Batch File Input

Solution 1:

you can use syntax similar your evaluation:

::Does string have a trailing slash? if so remove it 
IF %datapath:~-1%==\ SET datapath=%datapath:~0,-1%