Solved

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

Posted on 2009-07-12
1
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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