In this case, double quotes are your friend. So instead of something like this:
path\to\7z.exe -w$tempDir -tzip -mx1 a ....
you'd do this:
path\to\7z.exe "-w$tempDir" -tzip -mx1 a ...
PowerShell will parse between the double quotes to replace the $tempDir variable appropriately.
You can, FWIW, also escape the hyphen with a back tick ( ` ) to do the same thing. I happen to think the quotes option is more readable, but either works well.
path\to\7z.exe `-w$tempDir -tzip -mx1 a ...
No comments:
Post a Comment
Thanks for leaving a comment!