Skip to content

Instantly share code, notes, and snippets.

@zabbarob
Last active March 1, 2024 08:35
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save zabbarob/5891200 to your computer and use it in GitHub Desktop.
Save zabbarob/5891200 to your computer and use it in GitHub Desktop.
Make 7-Zip extract to folder when double-clicking archives. (based on http://superuser.com/a/447791)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\7-Zip.001\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.001\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.001\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.7z\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.7z\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.7z\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.arj\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.arj\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.arj\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.bz2\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.bz2\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.bz2\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.bzip2\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.bzip2\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.bzip2\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.cab\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.cab\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.cab\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.cpio\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.cpio\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.cpio\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.deb\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.deb\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.deb\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.dmg\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.dmg\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.dmg\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.fat\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.fat\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.fat\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.gz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.gz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.gz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.gzip\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.gzip\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.gzip\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.hfs\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.hfs\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.hfs\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.iso\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.iso\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.iso\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.lha\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.lha\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.lha\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.lzh\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.lzh\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.lzh\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.lzma\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.lzma\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.lzma\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.ntfs\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.ntfs\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.ntfs\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.rar\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.rar\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.rar\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.rpm\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.rpm\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.rpm\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.squashfs\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.squashfs\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.squashfs\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.swm\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.swm\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.swm\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.tar\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.tar\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.tar\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.taz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.taz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.taz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.tbz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.tbz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.tbz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.tbz2\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.tbz2\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.tbz2\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.tgz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.tgz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.tgz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.tpz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.tpz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.tpz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.txz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.txz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.txz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.vhd\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.vhd\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.vhd\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.wim\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.wim\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.wim\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.xar\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.xar\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.xar\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.xz\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.xz\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.xz\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.z\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.z\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.z\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
[HKEY_CLASSES_ROOT\7-Zip.zip\shell]
@="extract"
[HKEY_CLASSES_ROOT\7-Zip.zip\shell\extract]
@="Extract to Folder"
[HKEY_CLASSES_ROOT\7-Zip.zip\shell\extract\command]
@="\"C:\\Program Files\\7-Zip\\7zG.exe\" x \"%1\" -o*"
@Daniel-Beardsmore
Copy link

Daniel-Beardsmore commented Jul 15, 2016

Interesting idea. What I was hoping Igor would implement is the behaviour of StuffIt Expander for Mac (that StuffIt eventually removed!) where Extract only creates an enclosing folder if the root of the archive contains multiple items.

Edit: http://telcontar.net/Software/7-ade/ — finally knocked something together to provide this functionality

@RemiSemantix
Copy link

Worked like a charm! Thx :)

@zabbarob
Copy link
Author

It's been a while since I looked that up, maybe 7-Zips command line interface changed. Other than that, regedit must be run as administrator if you haven't done so already

@Snegovikufa
Copy link

Best time saver 👍

@welby12
Copy link

welby12 commented Dec 24, 2019

Thanks so much, this is exactly what I wanted it to do. No more navigating through right click menus to do the same thing always!!

@jedimasterSifo-Dyas
Copy link

jedimasterSifo-Dyas commented Mar 3, 2020

Thank you, this is precisely what i needed. However, Is there a way to modify this so double-click always extracts to the Desktop? I would be most grateful.

@Lakitna
Copy link

Lakitna commented Mar 10, 2020

Thank you, this is precisely what i needed. However, Is there a way to modify this so double-click always extracts to the Desktop? I would be most grateful.

Yes, that is possible by changing the -o* at the end of the lines. See the reference for details: https://sevenzip.osdn.jp/chm/cmdline/switches/output_dir.htm

@DigiEggz
Copy link

DigiEggz commented Jul 5, 2020

Interesting idea. What I was hoping Igor would implement is the behaviour of StuffIt Expander for Mac (that StuffIt eventually removed!) where Extract only creates an enclosing folder if the root of the archive contains multiple items.

Edit: http://telcontar.net/Software/7-ade/ — finally knocked something together to provide this functionality

This is beautiful. Thank you so much for this.

@tgienger
Copy link

Next step, open the newly created folder once extracted :)

@Xarishark
Copy link

I used the reg file and its awesome. Is there a way to remove the setting if I want?

@zabbarob
Copy link
Author

zabbarob commented Aug 4, 2022

@Xarishark Try removing the file associations in 7-Zip's settings. I haven't tried that out myself (I'm currently not on a Windows system), but it might do what you want? Alternatively, you can always run regedit and remove the individual keys manually

@SmaugTD
Copy link

SmaugTD commented May 5, 2023

No idea why this is not an option in the program settings, thanks a bunch man.

@DarseZSzabo
Copy link

Sadly this doesn't appear to work on Win11. After merging with registry, double clicking ZIP breaks file association, requiring it to be re-associated, then when double clicking briefly opens a CMD window which then disappears.

@Daniel-Beardsmore
Copy link

Standard practice in older versions of Windows was to just dump file associations into HKEY_CLASSES_ROOT, which means that user B installing a program of their choice would clobber the file associations for software previously installed by user A. XP had a weird bodge that let you reassign a file type to another program on a per-user basis but such associations did not allow verbs (Edit, Print etc).

From either Vista or 7 onwards, a new arrangement was introduced. HKEY_CLASSES_ROOT still defines the file types, but it is no longer responsible for file associations. Each user is free to associate any filename extension with any of the available types for that extension. For example, they can choose whether .html files open in Edge, Firefox or Chrome, without affecting any other user’s choice.

This process requires an additional set of Registry entries that define the program itself, along with all the file types it provides, and this is how Windows is now able to offer a user an intelligent set of alternatives.

I just tested 7-ade in Windows 11, and it works just fine. I installed 7-Zip and then 7-ade, then double-clicked a zip file, and Windows 11 offered 7-ade as a choice for opening zip files. The zip file unpacked just fine.

The .reg file above is a strange one, because it does not introduce a new application, so I am unclear how exactly Windows is meant to interpret the directives. Besides, there is also no single sensible action that can be put into a command line: you have to examine the archive contents to see whether it has more than one item at the root, and thus whether an enclosing folder is needed. Yes it would be nice if 7-Zip did all this automatically, but it doesn’t. Hence 7-ade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment