Thursday, May 20, 2010

PowerShell and slash-colon parameters

PowerShell plays around with the quotes in parameters when part of the parameter is quoted like this:

/param:"quoted path"

This gets passed to the application as:
"/param:quoted path"

The only workaround I have found works like this:
$cmd = "& `"application`" /p:`"path`"; `$result = `$?"
Invoke-expression $cmd
if(!$result)
{
    throw "Application failed."
}

0 comments:

Post a Comment