首页 > 解决方案 > Powershell - 解压缩 7z 文件

问题描述

我在使用 Powershell 解压缩 7z 文件时遇到问题,尽管这里有很多需要的信息: unzip file using 7z in powershell

当我使用相同的方法时:

$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe"
Set-Alias 7zip $7zipPath
$ZipFilePath = "C:\Users\lpiech\Documents\Lukasz\PowerShell\Test\20200113.7z"
$DestinationUzipPath = "C:\Users\lpiech\Documents\Lukasz\PowerShell\Test\"
7zip x -o$DestinationUzipPath $ZipFilePath -r;

我得到这个答案ResultsScreen 但在目的地我没有任何文件在“测试”文件夹中并且脚本没有完成它停止我“运行”模式。我应该怎么做才能获得解压缩的文件?

标签: powershell

解决方案


为什么人们喜欢以艰难的方式做事?

$env:path += ';C:\Program Files\7-Zip'
7zip x -oDocuments\Lukasz\PowerShell\Test Documents\Lukasz\PowerShell\Test\20200113.7z -r 

推荐阅读