Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在PowerShell中添加Atlassian竹变量?_Powershell_Bamboo - Fatal编程技术网

如何在PowerShell中添加Atlassian竹变量?

如何在PowerShell中添加Atlassian竹变量?,powershell,bamboo,Powershell,Bamboo,我很难弄明白这一点,我有以下powershell脚本,简单的一个: $BambooPath = 'C:\StartFolder\*' $RemoteWebPath = 'C:\DestFolder' Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse 我不想在$BambooPath中将C:\StartFolder*替换为 ${bambon.build.working.directory}*变量…有人知道怎么做吗?如果

我很难弄明白这一点,我有以下powershell脚本,简单的一个:

$BambooPath = 'C:\StartFolder\*'
$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse
我不想在$BambooPath中将C:\StartFolder*替换为
${bambon.build.working.directory}*变量…有人知道怎么做吗?

如果您有内联PS脚本,可以在参数字段中指定参数:

-BambooPath ${bamboo.build.working.directory}
并添加您的脚本如下所示

param (
    [string]$BambooPath = ""
)

$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse

使用下划线而不是点来访问环境变量:

$BambooPath = $Env:bamboo_build_working_directory
$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse

它是环境变量吗?在这种情况下$env:bambol.build.working.directory是一个bambor变量,只有$bambor\u build\u working\u directory?再看看这个:嗯,它似乎对我不起作用…:如果我做$ENV:它会复制整个C:Drive:嗯,对不起,我没主意了;我建议你写在竹子论坛上