Search code examples
c#windowswindows-7registryexplorer

Adding program to the windows explorer context menu


How do I add the program into context menu to receive the folder as argument while making the new item available when clicking on the folder background?

As of now I am trying to add the program to the HKEY_CURRENT_USER\Software\Classes\directory\Background\shell\MyProgram\command and I do see the new menu item, however, if I try to add %1 to receive the argument it is not working - I get an error.

As example:

F:\Programs\program.exe - Program starting correctly without receiving any arguments.

"F:\Programs\program.exe" "%1" - Error

This file does not have a program associated with it for performing this action.

"F:\Programs\program.exe %1"- Error

Application not found.

From what I have read the second option should be correct, but it is not working, why?


Solution

  • The parameter should be %V, not %1, as it seems %V returns a directory it was called from, while %1 returns a file it was called from.