6
インターネットから次のスクリプトを取得しましたが、実行しようとするとエラーが表示されます。Powershell解凍エラー
#script
#unzip folder
$shell_app = new-object -com shell.application
$filename = "test.zip"
$zip_file = $shell_app.namespace("C:\temp\$filename")
#set the destination directory for the extracts
$destination = $shell_app.namespace("C:\temp\zipfiles")
#unzip the file
$destination.Copyhere($zip_file.items())
---あなたが作成する必要があるエラーメッセージ
You cannot call a method on a null-valued expression.
At line:1 char:22
+ $destination.Copyhere <<<< ($zip_file.items())
+ CategoryInfo : InvalidOperation: (Copyhere:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
$ destinationをチェックしてください、おそらくnullです'$ destination -eq $ null'はTrueを返します。 –