Reputation: 29387
What I'm trying to do is to put a simple echo
message on the console saying:
variable named %%x has value of 'this is text inside the variable
so command I must do must escape the percentages that belong to variable name so it doesn't evaluate. Normally the escape character for %
is another %
. So this works:
echo %%variable%% has value: %variable%
But this doesn't, seems that double percent variables used in for
loops always evaluate:
echo %%%%x has value: %%x
Upvotes: 1
Views: 816
Reputation: 101666
This is a silly hack that seems to work:
setlocal enabledelayedexpansion
set percent=%%
for %%a in (*) do (
echo !percent!!percent!a is %%a
)
Or you can do set dblpercent=%%%%
and echo !dblpercent!a
...
Upvotes: 2