How to ignore %% from being evaluated?
One of my variables h开发者_如何学Cas the value %val%
- this is exactly the name!
So: set variable=%val%
What happens now is that when running the script the variable will be set to nothing as the %val%
is being evaluated! But this is not what I want... How can I tell DOS to ignore the %-sign here?
Use double %
characters to escape a single one:
set variable=%%val%%
Look here for different kinds of escape characters.
SET variable=%%var%%
ECHO %variable%
PAUSE
Works on my machine.
set variable="%val%"
精彩评论