PS 2.0 e superior:
If you specify an array of values, it will automatically expand them into separate parameters.
& rabbitmqctl @('set_policy mirroring', '^(?!(?:amq\.)).+$', '{ha-mode:all}')
Using
Start-Process
cmdlet.
Start-Process -FilePath 'rabbitmqctl' -ArgumentList 'set_policy mirroring ^(?!(?:amq\.)).+$ {ha-mode:all}'
# Same as above, shortened using aliases and positional parameters
start rabbitmqctl 'set_policy mirroring ^(?!(?:amq\.)).+$ {ha-mode:all}'
saps rabbitmqctl 'set_policy mirroring ^(?!(?:amq\.)).+$ {ha-mode:all}'
PS 3.0 e superior:
...you can use the
--%
operator which tells PowerShell to stop parsing from that point onward until the end of the line. Everything from that operator onwards is parsed by the parser used by the program.
rabbitmqctl --% set_policy mirroring ^(?!(?:amq\.)).+$ {ha-mode:all}
Referência: