why does this code output this result

May 29, 2019 at 01:34:47
Specs: windows 10
code:

set "^=escapeOnly"
set hi=hi001
set str1="a^!bcd^!efg^^^^^^^^^^^^^!^^^^^^^^^^^!^^^^^^^^^^!hi^^^^^^^^^!^^^^!^!"


echo ----- original ----
echo  !str1!


echo ----- other 4 ----- 2x
echo " %str1%

output:

----- original ----
 "a!bcd!efg^^^^^^!^^^^^!^^^^^^^escapeOnly "

----- other 4 ----- 2x
" "aefg^!^^escapeOnly "

my confusion is in other 4, I tried to do expand and escape operations to build output in my mind, but I can not understand why my code output this.

thanks


See More: why does this code output this result

Report •

#1
August 22, 2019 at 06:27:29
I think you're doing it wrong by means of trying to setup a variable name that only exists out of one caret sign. I think you need to review your wider objective, and try to do it differently.

Report •
Related Solutions


Ask Question