Escape spaces in PowerShell and cmd

Deadly-Bagel almost had it I think. Don't use double quotes in $outputpath to keep Get-Content happy, but add them in your argument list string.

Be sure to escape with backtick `. In fact you might just want to do that with all the paths:

$outputpath = 'C:\Users\bob\Desktop\output new.xml'
Start -FilePath $sqlpackage -ArgumentList "/action:DeployReport /SourceFile:`"$dacpacpath`" /Profile:`"$profilepath`" /OutputPath:`"$outputpath`"" -NoNewWindow -Wait

[xml]$xmldocument = Get-Content -Path $outputpath

Tags:

Powershell