开发者

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%"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜