Running
@echo off
setlocal enabledelayedexpansion
set x=some value with unsafe (^&^<^>()") characters inside
if 1 == 1 (
echo "value of x (!x!) is interesting"
)
gives
"value of x (some value with unsafe (&<>()") characters inside) is interesting"
I had to put the value being echoed inside double quotes to avoid parsing error. I don't want these double quotes to be printed, however. Is there any way to temporarily (only to safely pass it to echo
command) quote value being printed?