How to unzip a file in Powershell?

前端 未结 9 2139
清歌不尽
清歌不尽 2020-11-29 17:07

I have a .zip file and need to unpack its entire content using Powershell. I\'m doing this but it doesn\'t seem to work:

$shell = New-Object -Co         


        
9条回答
  •  -上瘾入骨i
    2020-11-29 17:28

    ForEach Loop processes each ZIP file located within the $filepath variable

        foreach($file in $filepath)
        {
            $zip = $shell.NameSpace($file.FullName)
            foreach($item in $zip.items())
            {
                $shell.Namespace($file.DirectoryName).copyhere($item)
            }
            Remove-Item $file.FullName
        }
    

提交回复
热议问题