views:

56

answers:

3

Hi,

one of my variables has 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?

Can anybody out there help me with my question?

Thanks a lot...

A: 
set variable="%val%"
Daniel
(-1) doesn't work on my environment.
This does not work at my location ... :( But the solutions above are perfectly fine!Thanks a lot for your help here!
murxx
@murxx - If the solutions work, make sure to mark them as an answer, and upvote the ones you find useful.
CrimsonX
+1  A: 

Use double % characters to escape a single one:

set variable=%%val%%

Look here for different kinds of escape characters.

Frank Bollack
Thanks a lot, that worked out!
murxx
+1  A: 
SET variable=%%var%%

ECHO %variable%

PAUSE 

Works on my machine.

Thanks a lot, that worked out!
murxx