不考虑文本中的感叹号的话,下面两种写法作用相同:
call set "str=%%str:*:=%%"
set "str=!str:*:=!"
星号在字符串替换中的作用:
%PATH:str1=str2%
would expand the PATH environment variable, substituting each occurrence
of "str1" in the expanded result with "str2". "str2" can be the empty
string to effectively delete all occurrences of "str1" from the expanded
output. "str1" can begin with an asterisk, in which case it will match
everything from the beginning of the expanded output to the first
occurrence of the remaining portion of str1.