Windows – Making WinRAR extract archives to a folder named after the archive, when double-clicking RAR files

windows 7winrar

With WinRAR installed, when you right-click on a .rar file in Windows, you can browse to WinRAR -> Extract to [archive name] in the context menu, and WinRAR will extract the archive to a folder in the current directory.

Is there a way of making WinRAR do this by default, simply by double-clicking on the archive?

I rarely use WinRAR to actually browse archives and instead always use this context menu option so it would save considerable time.

Best Answer

  1. Open regedit

  2. Go to HKEY_CLASSES_ROOT\WinRAR\shell\open\command

  3. Change the (Default) value from "C:\Program Files\WinRAR\WinRAR.exe" "%1"
    to "C:\Program Files\WinRAR\WinRAR.exe" x "%1"

  4. If you have ZIP files associated with WinRAR too, change the corresponding value under
    HKEY_CLASSES_ROOT\WinRAR.ZIP\shell\open\command too.

(Obviously for 32-bit WinRAR the path will be different.)

This however will probably not create a sub-directory named after the archive in the current directory while extracting. (At least it doesn't for me given my WinRAR settings.) For that you'll have to change the (Default) value(s) mentioned above to something like "C:\Extract.bat" "%1", then create the batch file with the following content (just a single line):

"C:\Program Files\WinRAR\WinRAR.exe" x %1 "%~n1\"

This should do what you want, and as a bonus you can now right-click and "Open" multiple archives (or select them and press Enter) and they will all be automatically extracted to individual sub-directories by the batch file.

Note: The Extract to <archive name\> context menu entry is generated dynamically by the shell extension based on the archive's name, so no key by that name exists in the registry. For a static key it would be simple to just set it as the default action instead of Open, but this is not possible here due to the dynamic nature of the option.