I use 7-Zip in a portable way on various different systems and inside Windows Sandbox so the associations are missing every time I start on those systems. I can go to 7-Zip > Tools > Options > Press the "+" button to associate, and then go to the Options > 7-Zip tab and check "Integrate 7-Zip in shell context menu". However, it would be very convenient if there was a way to automate this.
Ideally, I would like to do this in PowerShell as part of a script that I use to adjust UI options when I am working on various servers, such that:
if (Test-Path "$SevenZipPath\7zFM.exe") {
# Add the 7-Zip menu into the File Explorer right-click context menu
# Apply associations for all 7-Zip supported file types
}
Is there a way to a) add the 7-Zip shell context menu, and b) apply all associations to 7-Zip?
I find clues to a) here (but for Visual Studio Code). It would be good to have an equivalent for 7-Zip.
File associations for b) might be harder as on searching for how to do that in general, most answers are broken and various sites suggest that ftype
/ assoc
stopped working due to a Windows Update around 2020 and never started worked again. It would be good to have a reliable/generic method that allows associating file types in Windows (how 7-Zip internally creates these associations is a mystery).