如何使用Powershell从7z文件中部分提取文件夹 [英] How to partially extract a folder from a 7z file using powershell

查看:177
本文介绍了如何使用Powershell从7z文件中部分提取文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自动化平台的安装。我已经制作了一个脚本,用于将可部署文件的版本压缩为7zip文件。

I'm trying to automate the install of my platform. I've made a script for compressing the build of the deployables to a 7zip file.

现在,我需要将部分文件夹解压缩到特定的位置。

Now i need to uncompress partially some folders to a specific destination.

包裹

-app1

--folder11

--- folder111

- -folder12

-app2

--folder21

--folder22

...

Package
-app1
--folder11
---folder111
--folder12
-app2
--folder21
--folder22
...

我需要创建一个powershell脚本来将 app1的内容提取到目标文件夹。

I need to create a powershell script to extract the content of 'app1' to a destination folder.

我一直在尝试使用以下内容命令,但结果不是我预期的那样。
我已经收到了完整路径,而不是递归地接收folder11的内容。

I've been trying to use the following command but the result is not the as i expected. I've been receiving the full path and not the content from folder11 recursivelly.

Set-Alias zip $ZipCommand
zip x $FilePath app1\folder11 -oc:DeployableFolder -r

有什么想法吗?

谢谢。

推荐答案

我尝试过,没有问题

set-alias zip "c:\Program Files\outils\7-Zip\7z.exe"
zip x program.7z python-core-2.6.1\lib -oc:\data

我最终得到了ac:\data\python-core-2.6.1,其中仅包含lib文件夹及其所有子文件夹&文件。

I eventually got a c:\data\python-core-2.6.1 which only contains the lib folder with all its subfolders & files.

我看到的唯一区别是输出路径中的反斜杠

The only difference I see is the backslash \ in the output path.

HTH

这篇关于如何使用Powershell从7z文件中部分提取文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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