I have a slight problem with Powershell strings. There is a Java program I'm using called SymmetricDS which accepts arguments to a Windows batch file for certain administrative functions. One of these is to open registration for a node, passing a string containing the node's group and id:
& .\bin\sym.bat -p symmetric.properties --open-registration 'store,01'
In the batch file, java is called, with properties I passed above being passed in like so:
java -Dthis -Dthat -Dfoo -Dbar %1 %2 %3 %4 %5 %6 %7 %8 %9
The function in the java itself fails after this part:
int index = argument.trim().indexOf(",");
if (index < 0) {
throw new SymmetricException("LauncherMissingFilenameTriggerSQL", OPTION_OPEN_REGISTRATION);
}
index
apparently is -1. Why it is not finding the comma character, I don't know. I just know that when I run the same in a .cmd or .bat file, it works just fine:
.\bin\sym.bat -p symmetric.properties --open-registration "store,01"
I suspect it has something to do with Powershell's string being Unicode, and something improper happens in their journey from there into a batch file and then into java.
Anybody know how I can call this directly in Powershell?
Resolved: zdan's answer works, as does tricking Powershell a little bit like this:
.\bin\sym.bat -p symmetric.properties --open-registration '"store,01"'