I want to pass the string "!changeme!" to a java program on the command line like:
java -cp "!AXIS2_CLASS_PATH!" ClientJava --userid admin --passwd "!changeme!"
Using Windows XP, Java jdk 1.6.0_07.
The AXIS2_CLASS_PATH gets replaced as normal, I assume by the java runtime. However the password of !changeme! also seems to be replaced with an empty string. I assume that this replacement is some sort of JVM feature.
Using the following program:
static int Run(String[] aArgs) {
for (String s: aArgs) {
System.out.println("arg: " + s);
}
return 0;
}
I get the following results:
"C:\Program Files\Java\jdk1.6.0_07\bin\java" -cp "!AXIS2_CLASS_PATH!"
ClientJava --userid admin --passwd "!changeme!"
arg: --userid
arg: admin
arg: --passwd
arg:
I need the password to be passed through as is. I've tried all sorts of escaping but I haven't found what I need to use.
Can anyone supply a hint on how to do this?
Solution as provided by Zach Scrivena is:
Use the caret to escape the exclamation mark.
java -cp "!AXIS2_CLASS_PATH!" ClientJava --xxx "^!changeme^!"
arg: --userid
arg: admin
arg: --passwd
arg: !changeme!