I cannot work out how to pass arguments that contain folders with spaces using msdeploy.exe and PowerShell v4.
Sample Powershell Script
I used the suggestion from the following: How do you call msdeploy from powershell when the parameters have spaces?
To derive a "cleaner" solution.
$msdeploy = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe";
write-warning "WITHOUT SPACE"
$fl1 = "d:\nospace\a.txt"
$fl2 = "d:\nospace\b.txt"
$md = $("`"{0}`" -verb:sync -source:filePath=`"{1}`" -dest:filePath=`"{2}`"" -f $msdeploy, $fl1, $fl2)
cmd.exe /C "`"$md`""
write-warning "WITH SPACE"
$fl1 = "d:\space space\a.txt"
$fl2 = "d:\space space\b.txt"
$md = $("`"{0}`" -verb:sync -source:filePath=`"{1}`" -dest:filePath=`"{2}`"" -f $msdeploy, $fl1, $fl2)
cmd.exe /C "`"$md`""