I need to save the variable in %%c temporarily which comes from a for loop. But when I try to do that, the content changes unexpectedly. Some space characters appear at the end of the string. The content of %%c is a.jpg by the way.
echo %%ca REM prints a.jpga set temp=%%c set temp=!temp! echo !temp!a REM prints a.jpg a
I tried the code below to get rid of the extra spaces after initializing the temp variable. But it gave me an error: "=%" was unexpected at this time". What am I missing? Thanks in advance!
set "this=!temp!" set "this=%this:* =%" call set "this=%%temp:%this%=%%" set "this=%this:~0,-1%" echo %this%a