0

.tar.gz アーカイブに圧縮されたいくつかのファイルを単一のファイルに変換しようとしています。そのためには、まずファイルを untar する必要があります。

ディレクトリにロードされた 7z.exe のコピーがあり、ローカルでコマンドを呼び出すと動作します

.\7z.exe x *.tar.gz

実行される run.ps1 ファイルと一緒に wwwroot/poshUntar ディレクトリに exe をアップロードし、オンライン エディターを使用して 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 関数内で実行可能ファイルを呼び出す正しい方法は何ですか?

ここに画像の説明を入力

4

1 に答える 1

2

7z.dll も wwwroot ディレクトリにアップロードする必要があると思います。

スクリプトで次のコード セグメントを使用してみてください。

Set-Location D:\home\site\wwwroot\poshUntar
.\7z.exe x *.tar.gz 
.\7z.exe x *.tar -ologs
于 2016-06-15T06:46:16.137 に答える