Solved

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

Posted on 2009-07-12
1
351 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:JimR123b
1 Comment
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 250 total points
ID: 24834390
You can use %* in the command to get all dropped filed instead of only the first. Try if that will make explorer send all the folders to the same instance.
[HKEY_CLASSES_ROOT\Folder\shell\ConvertImagesForIPhone\command]
@="\"C:\\dev\\mainline\\vs\\AutoRotatePhotos\\AutoRotatePhotos\\bin\\Debug\\AutoRotatePhotos.exe\" \"%*\""

Open in new window

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Replace &lt; with < 14 59
Filename to be appended with DateTimeof Download 3 55
C# bracket error 3 30
List<PaisEntity> - show some 1 24
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question