解压缩受密码保护的文件 [英] Unzip Password-protected files

查看:39
本文介绍了解压缩受密码保护的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 PowerShell 从 USB 驱动器中受密码保护的 zip 中提取文件.我查了很多方法,但最简单的方法似乎不起作用.

$7ZipPath = "C:Program Files7-Zip7z.exe"$zipFile = "E:passwordprotectedtest.zip"$zipFilePassword = "Foo"&$7ZipPath e -oE: -y -tzip -p "$zipFilePassword" "$zipFile"

我不断收到此错误:

7-Zip 9.20 版权所有 (c) 1999-2010 Igor Pavlov 2010-11-18错误此命令不能使用绝对路径名

然后我将文件移到我的桌面,更改了 $zipFile = "passwordprotectedtest.zip",将 -oE: 更改为 -oC:.>

修复了路径名错误,但开始出现此错误

7-Zip 9.20 版权所有 (c) 1999-2010 Igor Pavlov 2010-11-18错误找不到存档

解决方案

试试这个:

$7ZipPath = '"C:Program Files7-Zip7z.exe"'$zipFile = '"e:passwordprotectedtest.zip"'$zipFilePassword = "Foo"$command = "& $7ZipPath e -oe: -y -tzip -p$zipFilePassword $zipFile"iex $命令

I am trying to extract files from a password-protected zip, in a USB drive, using PowerShell. I have looked up many ways but the easiest one doesn't seem to work.

$7ZipPath = "C:Program Files7-Zip7z.exe"
$zipFile = "E:passwordprotectedtest.zip"
$zipFilePassword = "Foo"

& $7ZipPath e -oE: -y -tzip -p "$zipFilePassword" "$zipFile"

I keep getting this error:

7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Error
Cannot use absolute pathnames for this command

I then moved to the file to my desktop, changed $zipFile = "passwordprotectedtest.zip", changed -oE: to -oC:.

That fixed the pathname error but started getting this error instead

7-Zip 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Error
Cannot find archive

解决方案

Try this way:

$7ZipPath = '"C:Program Files7-Zip7z.exe"'
$zipFile = '"e:passwordprotectedtest.zip"'
$zipFilePassword = "Foo"
$command = "& $7ZipPath e -oe: -y -tzip -p$zipFilePassword $zipFile"
iex $command

这篇关于解压缩受密码保护的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆