Search code examples
windows-10regedit

Modifying compressed zip folder context menu


I am currently developing a piece of software that will be used to upload files to SharePoint Online. I am currently adding options to the right click menu for different types of files to allow easy integration with the software, however I have run into a bit of an issue.

I have separate commands for files and folders and have currently added them as follows:

[HKEY_CURRENT_USER\Software\Classes\Folder\shell\Transfer]
@="Upload Folder to SharePoint"
"AppliesTo"="under:T:\\**\\**\\** OR J:\\**\\**\\** OR Q:\\**\\**\\**"
"Icon"="Path to Icon"

[HKEY_CURRENT_USER\Software\Classes\Folder\shell\Transfer\command]
@="Command for Folders"


[HKEY_CURRENT_USER\Software\Classes\*\shell\Transfer]
@="Upload File to SharePoint"
"AppliesTo"="under:T:\\**\\**\\** OR J:\\**\\**\\** OR Q:\\**\\**\\**"
"Icon"="Path to Icon"

[HKEY_CURRENT_USER\Software\Classes\*\shell\Transfer\command]
@="Command for files"

The above registry keys work perfectly and as intended, however a problem has occured relating to ZIP files. ZIPs are getting the context menu added under HKCU\Software\Classes\Folder\ instead of HKCU\Software\Classes\*\. Because of this, the context menu for ZIPs specifically causes issues with the software as it is expecting a directory folder but receives a ZIP file.

I have tried googling to find a location for putting the registry keys for ZIPs but I have been unable to find it. Does anyone know how I can either add these registry keys for specifically just ZIP files and hide the Folder additions or change the Folder registry keys to use a different command for ZIPs?


Solution

  • I managed to find the solution. It was necessary to make an association for .zip to CompressedFolder by doing:

    [HKEY_CURRENT_USER\Software\Classes\.zip]
    @="CompressedFolder"
    

    Then I could put everything I needed under:

    [HKEY_CURRENT_USER\Software\Classes\CompressedFolder\shell\GPATransfer]
    @="Upload File to SharePoint"
    

    Now anything under HKCU\Software\Classes\Folder\ does not get applied to zips. Instead, anything under HKCU\Software\Classes\CompressedFolder\ is applied to zips.