【问题标题】:usage of xcopy command in octopus deploy PostDeploy.ps1在章鱼部署 PostDeploy.ps1 中使用 xcopy 命令
【发布时间】:2015-12-22 02:20:51
【问题描述】:

我正在尝试在 octopus deploy 中使用 xcopy 复制文件。但似乎 xcopy 不起作用。这是我在 PostDeploy.ps1 中使用的命令

xcopy Content C:\websitecode /e /y /exclude:test.txt

使用 xcopy 的原因是我可以排除多个文件。

有人可以帮我如何在章鱼部署中使用 xcopy...

谢谢。

【问题讨论】:

  • xcopy is not working 到底是什么意思?没有复制文件?复制了错误的文件?正确的文件复制到错误的目录?还有什么意外行为?
  • 您好 VonPryz,感谢您的回复。就我而言,xcopy 没有复制文件,我没有看到任何错误。
  • text.txt 文件中有什么内容?
  • this question 的回答中所指出的,您可以使用 Powershells copy-item 通过将 get-childitem 管道传输到 copy-item 来排除多个项目。因此,您不必使用 xcopy 来实现您想要的。
  • @tobre 是的。那可行。谢谢你。

标签: powershell command-line octopus-deploy


【解决方案1】:

您能否在 octopus 部署任务日志中看到您的 postdeploy.ps1 执行已开始?如果你能看到,试试我最喜欢的 xcopy 脚本,我已经在使用它了。

$FullPath = "C:\MyFolder"

if ($OctopusEnvironmentName -ceq 'Development')

{
  Write-Host "Console app will be execute"

  & "xcopy" $FullPath/myfolder/*.dll "c:\targetfolder" your parameters | Write-Host

  Write-Host "Console app execution has finied"

}

【讨论】:

    【解决方案2】:

    Octopus 默默地吃 xcopy 和 Octopus 人 don't seem too concerned about it 是一个已知问题,提供了大量解决方法,例如“只使用 copy-item”。这主要对我有用,但我希望我能理解为什么 xcopy 不起作用,因为其他事情也可能会默默地失败。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多