1

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)

2 Answers 2

2

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"
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.