CeeMoney
CeeMoney

Reputation: 215

Post-Build powershell - help getting syntax (spaces help)

Running a post-build powershell command and my path has spaces as does the two args I'm trying to pass. I have no idea how to get this to work. One of the issues is a fun little double-quote that is showing up. Ultimately the following is what I'm looking for........

powershell -file "$(ProjectDir)PS\upgradeApp.ps1" -projDir "$(ProjectDir)" -targetDir "$(TargetDir)"

Note -- projDir has spaces as does targetDir. Fine, let's just get the first arg....

powershell -file "$(ProjectDir)PS\upgradeApp.ps1" -projDir "$(ProjectDir)"

What happens then is I'm mysteriously left with a trailing double-quote for the projectDir arg. Why?

C:\Users\user.domain\Documents\Visual Studio 2015\Projects\WikiAdditions\WikiAdditions"

I've tried putting in single quotes, then double-quotes but then I get a trailing single quote. So what's the magic formula here?

Upvotes: 0

Views: 277

Answers (1)

CeeMoney
CeeMoney

Reputation: 215

Finally figured it out........... thanks for the headache Powershell, because that looks logical.

powershell.exe –command "& { &'$(ProjectDir)PS\upgradeApp.ps1' '$(ProjectDir)' '$(TargetDir)' }"

Upvotes: 2

Related Questions