stakor
asked on
Trouble with a special character in a batch file variable
I am having trouble with a variable in a batch file. I am setting a variable with special characters, and having trouble getting them to print.
One of the two special characters is %. That one, I got to print by putting two of them in the variable. (aka % became %%) The other character is ^. I have seen that ^^ should work. But, it does not.
The (literal) string that should print is:
P%@AP[4\PZX54(P^)7
Batch file I am using:
@ECHO OFF
SET location=P%%@AP[4\PZX54(P^ ^)7
ECHO %location%
My output is:
P%@AP[4\PZX54(P)7
<Missing the ^>
Might I need to escape the ()'s somehow?
One of the two special characters is %. That one, I got to print by putting two of them in the variable. (aka % became %%) The other character is ^. I have seen that ^^ should work. But, it does not.
The (literal) string that should print is:
P%@AP[4\PZX54(P^)7
Batch file I am using:
@ECHO OFF
SET location=P%%@AP[4\PZX54(P^
ECHO %location%
My output is:
P%@AP[4\PZX54(P)7
<Missing the ^>
Might I need to escape the ()'s somehow?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER