What is the difference between these 2 pieces of code in a batch file?
set str=!str:%%20= !
and
set str=%str:%%20= %
What is the difference between these 2 pieces of code in a batch file?
set str=!str:%%20= !
and
set str=%str:%%20= %
Finally, after hours I could find the explanation. According to this page How-to: Escape Characters, Delimiters and Quotes at the Windows command line in the paragraph "Escaping Percents" :
Escaping Exclamation marks When the shell is running in EnableDelayedExpansion mode the ! character is used to denote a variable and so must be escaped (twice) if you wish to treat it as a regular character:
^^!