How do you call msdeploy from powershell when the parameters have spaces?

后端 未结 9 1267
忘了有多久
忘了有多久 2020-11-30 05:52

I\'m running into a problem with spaces in my parameters that I try to send into msdeploy from a powershell script.

There are a number of other related articles but

9条回答
  •  不知归路
    2020-11-30 06:14

    We had faced the similar kind of issue. Our fix was like below,

    $path = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe";
    
    $verb = "-verb:sync";
    
    $src = "-source:contentPath=[ESC][ESC][ESC]"c:\aa aa[ESC][ESC][ESC]";
    
    $dest = "-dest:contentPath=[ESC][ESC][ESC]"c:\aa[ESC][ESC][ESC]";
    
    Invoke-Expression "&'$path' $verb $src $dest"; 
    

    where, ESC - is escape sequence/character

提交回复
热议问题