Link to home
Start Free TrialLog in
Avatar of allelopath
allelopath

asked on

7 zip: change to extract on double-click

How can change 7-zip so that when a zip file is double-clicked, it extracts that file?
I've associated zip files with 7-zip, but this results in it opening in archive folder on a double-click. I've tried all 3 executables in the 7-zip program files directory.

Running Windows 7, obviously
SOLUTION
Avatar of FastSi
FastSi
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Raymond Peng
Raymond Peng
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i would like to know if my post helped or not
plse give feedback !
Here's a simple batch file you can use.  There's no error checking or anything like that.  It just passes the file name and location to 7z for extraction.

With your favourite text editor, save the following code as a .cmd file in a folder inside your path statement.  C:\Windows is the easiest.  If you use notepad, make sure it saves the file with .cmd and not .cmd.txt.

@echo off
"C:\Program Files\7-Zip\7zG.exe" x "%~f1" -o"%~dp1%~n1"

Open in new window


Verify the correct path to your 7zG.exe.  Change it as needed.  Be sure, though, you maintain the "" around the exe location.

Then right-click on a 7Zip archive and select "Open With" then select "Choose Program".  Select "Browse".  Then navigate to the folder where you save the cmd file and select it and click "Open".  Be sure to check the box next to "Always use the selected program to open this kind of file."
hey ltam, does that work also for winzip files, if the path is changed to winzip ?
Winzip has it's own command line options.  The simplest way would be to just associate the archives you want to extract on double-click with that cmd file and 7Zip will extract it.

Or you could try something like this:

@echo off
if /i %~x1 == .7z "C:\Program Files\7-Zip\7zG.exe" x "%~f1" -o"%~dp1%~n1"
if /i %~x1 == .zip "C:\Program Files\WinZip\WINZIP32.EXE" -e "%~f1" "%~dp1%~n1"

Open in new window


This will execute 7Zip for all .7z files and winzip for all .zip files.  With the variety of archive names, I think just associating them all with the simple batch file is the easiest.  I believe 7Zip handles just about every archive out there.

Winzip has an add-on for command line functionality, but I've been able to pass commands to the executable without the module installed.  I also think the command line add-on doesn't work with the evaluation version.

As for winrar, I haven't worked with it on a command-line at all, so I'd have to do some hunting for syntax and such.
tx for the info - appreciated!