Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I made an application that zips and puts any folder dropped onto it into backup folder on my disk. I'd like to be able to launch it with a parameter of a folder's full path via context menu.

How do I add my application to all folders' context menu and use the folder's path as a parameter in the command line?

share|improve this question

1 Answer 1

up vote 2 down vote accepted
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\myapp]
@="&MyApp"
"Icon"="shell32.dll,43"
"MultiSelectModel"="Single"

[HKEY_CLASSES_ROOT\Folder\shell\myapp\command]
@="C:\\MyApp.bat \"%1\""

The above saved as a .REG file and imported into the registry will run your app and pass the full path of the selected folder to it as the first argument. Here's the content of MyApp.bat for testing:

@echo off
for %%a in (%*) do echo Argument = %%a
pause

Remove the MultiSelectModel line if you want the context menu entry to show up even when you select multiple folders and right-click.

However, this is more of a manual/hack-y method. I highly recommend you read the Creating Shortcut Menu Handlers MSDN article and ask over on StackOverflow about how to make your app's installer properly register your app as a valid context menu handler.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.