14

I have 7-Zip installed, and it hasn't changed the default file associations. I've changed the associations for .rar and .7z, but I can't find a way to change .zip.

I looked in Default Programs\Set Associations, and I searched for .zip, but it's not there. Seriously it goes from .z, .z96, .zoo. It seems to skip .zip. How can I fix this? If it needs to be, I'm fine with registry edits.

4 Answers 4

17

7-Zip does not associate itself with the various compressed file types.

To associate .zip file types with 7-Zip, do the following:

  1. Open the 7-Zip File Manager with Administrator Rights from your start menu
  2. Go to the tools menu and select options
  3. Either select the individual extensions you wish to associate or press the “Select All” button (recommended).
  4. Press OK to save your changes

Source: https://community.spiceworks.com/how_to/45718-set-file-associations-to-work-with-7-zip-in-windows-7-windows-server-2008-r2

2
  • The link is (effectively) broken. It redirects to a generic page. Jul 5, 2018 at 4:27
  • @PeterMortensen I've updated the link with another one.
    – clhy
    Jul 5, 2018 at 6:07
5

Elevate the 7-Zip File Manager to run as an administrator. Then click menu ToolsOptions and choose your file associations.

Or if you're in an elevated command prompt you can use assoc and ftype to tweak your system:

C:\WINDOWS\system32>assoc .zip=7-Zip.zip
.zip=7-Zip.zip

C:\WINDOWS\system32>ftype 7-Zip.zip=C:\Program Files\7-Zip\7zFM.exe
7-Zip.zip=C:\Program Files\7-Zip\7zFM.exe

The default for .zip is CompressedFolder:

C:\WINDOWS\system32>assoc .zip=CompressedFolder

C:\WINDOWS\system32>ftype CompressedFolder=%SystemRoot%\Explorer.exe /idlist,%I,%L
1
  • 1
    Ah, I just needed to know the executable to choose from the "Open With" prompt in Windows. So it is 7zFM.exe where 7zFM stands for 7-Zip File Manager (according to the "details" in the file properties). This comment is just for search engines to find the "Open With" really :) Jul 20, 2020 at 8:26
0

When right-clicking on the file, open it with another application, and set it as the default from the Windows default dialogue.

Contextual Menu on file

Default Picker

0

User Jake Barteaux @day1player on GitHub made a nice code snippet to achieve this.

#### Set file associations ####
Write-Host "[-] Setting file associations..." -ForegroundColor Green
# Zip
$7zip = "${Env:ProgramFiles}\7-Zip\7z.exe"
if (Test-Path $7zip) {
  $7zipfiletype = "7z.exe"
  cmd /c assoc .zip=$7zipfiletype | Out-Null
  cmd /c assoc .7z=$7zipfiletype | Out-Null
  cmd /c assoc .tar=$7zipfiletype | Out-Null
  cmd /c assoc .bz=$7zipfiletype | Out-Null
  cmd /c assoc .gz=$7zipfiletype | Out-Null
  cmd /c assoc .gzip=$7zipfiletype | Out-Null
  cmd /c assoc .bzip=$7zipfiletype | Out-Null
  cmd /c @"
    ftype $7zipfiletype="$7zip" "%1" "%*" > NUL
"@
  New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  Set-ItemProperty -Path "HKCR:\$7zipfiletype" -Name "(DEFAULT)" -Value "$7zipfiletype file" -Force | Out-Null
  Write-Host "`t[+] 7zip -> .zip" -ForegroundColor Green
}

We can generalize this approach with all the file formats listed as supported by 7-Zip.

# Zip
$7zip = "${Env:ProgramFiles}\7-Zip\7z.exe"
if (Test-Path $7zip)
{
  $7zipfiletype = '7z.exe'
  foreach ($ext in '7z', 'XZ', 'BZIP2', 'GZIP', 'TAR', 'ZIP', 'WIM', 'APFS', 'AR', 'ARJ', 'CAB', 'CHM', 'CPIO', 'CramFS', 'DMG', 'EXT', 'FAT', 'GPT', 'HFS', 'IHEX', 'ISO', 'LZH', 'LZMA', 'MBR', 'MSI', 'NSIS', 'NTFS', 'QCOW2', 'RAR', 'RPM', 'SquashFS', 'UDF', 'UEFI', 'VDI', 'VHD', 'VHDX', 'VMDK', 'XAR', 'Z')
  {
    cmd /c assoc .zip=$7zipfiletype | Out-Null
  }
  cmd /c @"
    ftype $7zipfiletype="$7zip" "%1" "%*" > NUL
"@
  New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null
  Set-ItemProperty -Path "HKCR:\$7zipfiletype" -Name '(DEFAULT)' -Value "$7zipfiletype file" -Force | Out-Null
  Write-Host "`t[+] 7zip -> .zip" -ForegroundColor Green
}

This should associate all the available file types with 7zip.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .