Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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 '14 at 5:25

As a follow-up to surfasb's answer, add a -r flag at the end to recurse:

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

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

PS: 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 '14 at 5:25
1  
Should be fine by separating the filters by space. See the edited answer above. :) – Lee Aug 26 '14 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.