I’m trying to add a menu button when I right click a file and the button will let me execute a command. To be more specific, I’m trying to right click a apk file, and the I can execute a “adb install” command of the selected file. I did some search and found out to add a menu item we need to modify the registry. But I’m not sure how to execute a command and moreover, how can I get the current selected file in right click? Any help will be much appreciated!
Read about Verbs and File Associations on MSDN.
If you don't need it to be the default command, adding it under SystemFileAssociations is a good idea and works on Windows XP and later.
A minimal .reg file might look like this:
REGEDIT4
[HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\.apk\shell\AdbInstall]
@="ADB Install"
[HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\.apk\shell\AdbInstall\command]
@="\"C:\\path\\to\\androidsdk\\adb.exe\" install \"%1\""
%1 is replaced with the full path of the file you right-click on.