I want to call a batch file with powershell, like this:
$databaseUrl = "jdbc:sqlserver://$($databaseConfig.Server):$($databaseConfig.Port);databaseName=$($databaseConfig.Name)"
./database/liquibase/liquibase.bat --url=$databaseUrl
My problem is that the = is replaced with a whitespace, leaving only --url as the first parameter. I try putting it in quotes:
.\database\liquibase\liquibase.bat "--url=$databaseUrl"
...with the same result. I read that I can use backtick to escape characters:
.\database\liquibase\liquibase.bat "--url`=$databaseUrl"
...but the equals sign still disappears. I have also tried using --% to prevent any formatting from happening:
.\database\liquibase\liquibase.bat --% "--url=$databaseUrl"
but then the variable $databaseUrl is interpreted verbatim.
Any help on how to pass the argument, unformatted, but with variables expanded would be greatly appreciated.
--url:<value>syntax as well, if you have the batch file under your control. There are a couple of questions, and comments, like this one that explain the details of the issue.java -cp "%CP%" %JAVA_OPTS% liquibase.integration.commandline.Main %CMD_LINE_ARGS%. When I start the java command from the powershell script, the formatting of the parameters seem to work. I think that is my best bet.