This tutorial helped me find the solution: https://medium.com/analytics-vidhya/creating-cascading-context-menus-with-the-windows-10-registry-f1cf3cd8398f
Issue with the tutorial above is that it showing the context menu for directories but I wanted to do it for a specific file extension (.exr in my case).
This answer: https://stackoverflow.com/a/47745854/13806195 show me how to do it for file extension. As you don't need the ProgID your keys are not associated with your default programs for the extension.
Here is how the final arborescence should looks like:
HKEY_CLASSES_ROOT
SystemFileAssociations
.exr
shell
root_menu_name
MUIVerb = "Pretty name of your menu"
subcommands = ""
shell
sub_menu_name_01
command
@=yourcommand
sub_menu_name_02
command
@=yourcommand
.reg file example to register the keys:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\\SystemFileAssociations\\.exr\\shell\\ExrCommands]
"MUIVerb"="Exr Commands"
"subCommands"= ""
[HKEY_CLASSES_ROOT\\SystemFileAssociations\\.exr\\shell\\ExrCommands\\shell\\cmd01\\command]
@="\\"D:\\\\Script\\\\APP.exe\\" \\"%1\\" \\"arg01\\""
[HKEY_CLASSES_ROOT\\SystemFileAssociations\\.exr\\shell\\ExrCommands\\shell\\cmd02\\command]
@="\\"D:\\\\Script\\\\APP.exe\\" \\"%1\\" \\"arg02\\""
Some tips for writing the reg file:
"
write \\"
instead. Same for \\
that needs to be \\\\
.