Problem: When using string substitution, it only works for the cleandate
but not the cleantime
variable.
set backupdate=%date:~10%%date:~4,-8%%date:~7,-5%
set cleandate=%backupdate: =%
set backuptime=%time:~0,2%%time:~3,-6%%time:~6,-3%
set cleantime=%backuptime: =%
echo %cleandate%\Test
echo %cleantime%\Test
pause
Output:
C:\Users\Sveta\Desktop>echo 20180514\Test
20180514\Test
C:\Users\Sveta\Desktop>echo 172317 \Test
172317 \Test
%cleantime%
still contains a space between the 172317
and \Test
. How do I fix it?