PowerShell & MSDeploy - Arguments with Spaces

后端 未结 4 1067
予麋鹿
予麋鹿 2021-01-07 10:39

I cannot work out how to pass arguments that contain folders with spaces using msdeploy.exe and PowerShell v4.

Sample Powershell Script



        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-07 11:04

    Found an easy solution. Ref: http://answered.site/all-arguments-must-begin-with--at-cwindowsdtldownloadswebserviceswebservicesidservicepublishedwebsitesidservicedeploymentidservicewsdeployps123/4231580/

    $msdeploy = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
    $msdeployArgs = @(
    "-verb:sync",
    "-source:iisApp='Default Web Site/HelloWorld'",
    "-verbose",
    "-dest:archiveDir='c:\temp1'"
    )
    Start-Process $msdeploy -NoNewWindow -ArgumentList $msdeployArgs
    

提交回复
热议问题