Link to home
Start Free TrialLog in
Avatar of JimR123b
JimR123bFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to pass multiple folders into my C# application's command line?

Hi,

I have an application that processes a folder's contents by the user going into Windows Explorer and right-clicking on a folder, and choosing to "Convert images for iPhone".

The "Convert images for iPhone" popup menu verb was added to my environment by using the shown registry data to my registry.

My C# Windows Forms application processes figures out which folder to process by inspecting the results of "Environment.GetCommandLineArgs()".

Currently, if I select multiple folders and choose my verb in Windows Explorer, it just opens up a new instance of my application for each folder. So, selecting 3 folders runs 3 instances of my application at the same time.

What I would like to do now, is be able to select multiple folders within Windows Explorer, and process that list of folders within a SINGLE instance of my application.

How can I achieve this?

Perhaps I can pass them all in a single command-line, as %1 %2 %3, etc. If so, how do I set this up?

Or, is there some way to tell Windows to only run one instance of my application, and pass the folder names in a way other than the command-line arguments? How would I do this?

Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\Folder\shell\ConvertImagesForIPhone]
@="Convert images for iPhone"
 
[HKEY_CLASSES_ROOT\Folder\shell\ConvertImagesForIPhone\command]
@="\"C:\\dev\\mainline\\vs\\AutoRotatePhotos\\AutoRotatePhotos\\bin\\Debug\\AutoRotatePhotos.exe\" \"%1\""

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Göran Andersson
Göran Andersson
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial