我有一个从Bamboo触发的PowerShell脚本,该脚本基本上接受3个字符串参数:
Param([string]$language, [string]$architecture ="x64", [string]$version)
$x64Path = "some path..."
$x86Path = "some path.."
$arguments = $language,$architecture,$version
If($architecture -eq "x64") {
Write-Host "Executing:" $x64Path" at x64 using" $language "and" $version
# & $x64Path $arguments
}
Else {
Write-Host "Executing:" $x86Path "at x86 using" $language "and" $version
# & $x86Path $arguments
}
如果我从ISE运行PowerShell脚本,例如:
.\MyScript.ps1 "JPN" "x64" "AB 6.0 R"
我将正确获得以下输出:
Executing: some path... at x64 using JPN and AB 6.0 R
我已经在Bamboo中创建了一个计划,其中包含以下内容:
我尝试将变量(参数)添加为:
"${bamboo.Language}" "${bamboo.Architecture}" ${bamboo.Version}
和aso
"${bamboo.Language}" "${bamboo.Architecture}" "${bamboo.Version}"
但是我总是得到相同的输出:
Executing: some path... at x64 using JPN and AB
请注意,最后一个变量已删除(我没有完整的 AB 6.0 R )
这是Bamboo的错误,还是我做错了什么?还是有解决方法?
答案 0 :(得分:0)
我怀疑在竹子中替换变量后(即在将参数传递给powershell之前),引号会被剥夺。
在带有空格的参数中添加内部单引号:
transform