PowerShell中的Azure函数用于卸载文件

PowerShell中的Azure函数用于卸载文件,powershell,azure,azure-functions,Powershell,Azure,Azure Functions,我正在尝试将一些压缩成.tar.gz归档文件的文件转换成单个文件。要这样做,我需要首先解除对文件的约束 我将7z.exe的副本加载到目录中,并在本地调用该命令 .\7z.exe x *.tar.gz 我已经将exe文件与执行的run.ps1文件一起上传到wwwroot/poshUntar目录中,并使用在线编辑器执行powershell脚本。我当然希望我的函数通常会失败,因为我没有提供变量值,但我不希望它在查找7z.exe文件时出错 .\7z.exe : The term '.\7z.exe'

我正在尝试将一些压缩成.tar.gz归档文件的文件转换成单个文件。要这样做,我需要首先解除对文件的约束

我将7z.exe的副本加载到目录中,并在本地调用该命令

.\7z.exe x *.tar.gz
我已经将exe文件与执行的run.ps1文件一起上传到wwwroot/poshUntar目录中,并使用在线编辑器执行powershell脚本。我当然希望我的函数通常会失败,因为我没有提供变量值,但我不希望它在查找7z.exe文件时出错

.\7z.exe : The term '.\7z.exe' is not recognized as the name of a cmdlet, 
function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
At D:\home\site\wwwroot\poshUntar\run.ps1:10 char:1
+ .\7z.exe x *.tar -o logs
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (.\7z.exe:String) [], CommandNot 
   FoundException
    + FullyQualifiedErrorId : CommandNotFoundException
在PowerShell Azure函数中调用可执行文件的正确方法是什么?


我认为您还需要将7z.dll上传到wwwroot目录中

能否尝试在脚本中使用以下代码段

Set-Location D:\home\site\wwwroot\poshUntar
.\7z.exe x *.tar.gz 
.\7z.exe x *.tar -ologs

我相信您还需要将7z.dll上传到wwwroot目录

能否尝试在脚本中使用以下代码段

Set-Location D:\home\site\wwwroot\poshUntar
.\7z.exe x *.tar.gz 
.\7z.exe x *.tar -ologs

仅供参考:对于像7z这样的工具,您可能希望跨多个功能重用,您可以将它们放在
D:\home\site\tools
文件夹中。运行时会自动将其添加到PATH中。仅供参考:对于7z之类的工具,您可能希望在多个功能中重复使用,可以将它们放在
D:\home\site\tools
文件夹中。运行时会自动将其添加到路径中。