Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I have an archive, for example, some.zip that contains one or more files, how can I extract only one file (I know the name of the file) with 7-Zip from the command line in Windows?

share|improve this question

2 Answers 2

You just add the filename at the end.

7z e [archive.zip]-o[outputdir] [fileFilter]

share|improve this answer
1  
How can I add multiple file filters, say .XML and .zip? Sorry if I'm hijacking this thread, I just didn't want to add a duplicate question. –  Fr0zenFyr Jun 21 at 5:25
7z e [archive.zip] -o[outputdir] [fileFilter] -r

Follow up to the answer above, add a -r flag at the end to recurse.

Multiple filters support:

7z e [archive.zip] -o[outputdir] [fileFilter_1] [fileFilter_2] -r

Example Multiple filters command line:

7z e archive.zip -o outputdir *.xml *.dll -r

P/S: I use 7za.exe instead of 7z.exe. This is the actual command i use in my script:

7za.exe x archive.zip -o outputdir *.xml *.pdb *.exe *.ocx *.dll -r
share|improve this answer
1  
How can I add multiple file filters, say .XML and .zip? Sorry if I'm hijacking this thread, I just didn't want to add a duplicate question. –  Fr0zenFyr Jun 21 at 5:25
1  
Should be fine by separating the filters by space. See the edited answer above. :) –  Lee Aug 26 at 14:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.