How to set 7Zip as the default application to open certain compressed files type via script?

How to set 7Zip as the default application to open certain compressed files type via script?

If you use 7-Zip in your organization and need to override the default applications set in Windows 10 or 11. This script will do it for you.

As an example, I deleted some file associations in 7-Zip File Manager. Its represented by the blanks in the screen shot bellow.

The script sets the desired file associations by modifying the registry. If ran as administrator it will change for all users.

After running the script, the file associations are updated as bellow.