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

Mih*_*986 2 powershell bamboo

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

$BambooPath = 'C:\StartFolder\*'
$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse
Run Code Online (Sandbox Code Playgroud)

我不想在 $BambooPath 中用 ${bamboo.build.working.directory}* 变量替换 C:\StartFolder* ......有人知道怎么做吗?

mhu*_*mhu 5

使用下划线代替点来访问 Bamboo 环境变量:

$BambooPath = $Env:bamboo_build_working_directory
$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse
Run Code Online (Sandbox Code Playgroud)