【发布时间】:2018-08-21 04:47:32
【问题描述】:
我已经能够通过在 Teamcity 中的一个构建配置中使用 Get-Item 命令获得 env:$var,但在另一个构建配置中却失败了。当我打印这些值时,我能够得到结果,但是当我使用 Get-childitem env:$var 时,它会失败并出现以下错误:
Get-childitem : Cannot find path 'TestDeploy_GhNew.promote.from.env' because
[19:34:32][Step 2/4] it does not exist.
[19:34:32][Step 2/4] At C:\BuildAgent\work\4aa6addd2114a494\deploy\foo.ps1:23 char:29
[19:34:33][Step 2/4] + $var = (Get-childitem env:$env_var).value
[19:34:33][Step 2/4] + ~~~~~~~~~~~~~~~~~~~~~~~~~~
[19:34:33][Step 2/4] + CategoryInfo : ObjectNotFound: (TestDeploy_GhNew.promote.from.e
[19:34:33][Step 2/4] nv:String) [Get-ChildItem], ItemNotFoundException
[19:34:33][Step 2/4] + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCh
[19:34:33][Step 2/4] ildItemCommand
我尝试在脚本窗口和Get-Item env:$var 中声明参数,但没有帮助。
【问题讨论】:
标签: powershell environment-variables teamcity