如何解压缩文件并使用7zip将其复制到特定位置?

Ray*_*and 5 powershell 7zip

我只是尝试在powershell中打开一个zip存档,并将其中的文件移动到特定位置.但它总是只移动zip文件夹.我究竟做错了什么 ?

这就是我现在拥有的:

Get-ChildItem C:\zipplayground\*.zip | % {"C:\Program Files (x86)\7-Zip\7zG.exe";
Move-Item $_ C:\unzipplayground\}
Run Code Online (Sandbox Code Playgroud)

Poo*_*nny 9

我相信正确的答案应该是这样的:

Get-ChildItem C:\zipplayground\*.zip | % {& "C:\Program Files\7-Zip\7z.exe" "x" $_.fullname "-oC:\unzipplayground"}
Run Code Online (Sandbox Code Playgroud)

Alroc几乎是正确的,但$_.fullname引号之间不起作用,他错过了-o7z 的参数.我正在使用7z.exe而不是7zg.exe,这样工作正常.

作为参考,命令行帮助可以在这里找到:http:x//sevenzip.sourceforge.jp/chm/cmdline/ 基本上,代表'eXtract'和-o'输出目录'