使用 powershell 获取 azure webjob 的当前工作目录

Get the current working directory of a azure webjob with powershell

我创建了一个 powershell 文件,它应该下载一个 .zip 文件:

$url = "https://volafile.io/get/GTw_OAH5W62w/t.zip"
$output = "%WEBROOT_PATH%\erp_tool_export.zip"

(New-Object System.Net.WebClient).DownloadFile($url, $output)

脚本执行没有任何错误,但我无法在我的站点上使用 kudu 资源管理器找到 .zip 文件。

一定是文件放的路径有问题

我检查了 kudu powershell cmd 中的 evn 变量:

Get-Childitem env:

有我在上面使用的变量'WEBROOT_PATH',但路径中没有文件: wwwroot 文件夹。

其实我想把zip文件放在webjob的当前工作目录下,怎么办?

PowerShell 对环境变量使用不同的语法。将行更改为:

$output = "$env:WEBROOT_PATH\erp_tool_export.zip"