Reputation: 4809
I'm attempting to write this in PowerShell:
cspack $a/ServiceDefinition.csdef /role:$b;$c /rolePropertiesFile:$a.$b;c$ /sites:$a;$b;$c /out:$out
But it looks like PowerShell needs this statement broken up which I'm having trouble with.
I get error/s like:
You must provide a value expression on the right hand side of the '/' operator
So how do I call an EXE file and provide a multi-line / switch argument in PowerShell If I do the following?
cspack.exe $a/ServiceDefinition.csdef `
/role:$b;$c ` (place backtick on the end)
/rolePropertiesFile:$a.$b;c$ (powershell complains on this line)
Upvotes: 1
Views: 393
Reputation: 201652
You need to escape the semi-colons as that is the statement separator in PowerShell. After each ;
PowerShell thinks it is executing a new command. Try this:
cspack $a/ServiceDefinition.csdef /role:$b`;$c /rolePropertiesFile:$a.$b`;c$ /sites:$a`;$b`;$c /out:$out
Upvotes: 1
Reputation: 16606
The error about the /
operator usually indicates that PowerShell is not treating the command as a command line; prefix a &
to force it to do so. Note you'll also need to use .\cspack
if cspack
is in the current directory. PowerShell will also treat semicolons as statement terminators, so you'll want to surround each parameter with quotes to prevent that.
& cspack "$a/ServiceDefinition.csdef" "/role:$b;$c" "/rolePropertiesFile:$a.$b;c$" "/sites:$a;$b;$c" "/out:$out"
Upvotes: 2