views:

236

answers:

3

Hi does anyone know how to get windows explorer to pass multiple files / folders through to an external app (c#) referenced in the registry?

I am current able to act upon a single file / folder using the %1 syntax but not sure how to get explorer to pass through multiple items.

Does anyone know how to do this?

+2  A: 

I don't think this is possible.

When you open multiple files using Explorer, it will launch a separate copy of your program for file. I don't think it's possible to override this behavior.

EDIT: I forgot about shell extensions. This is possible.

To work around this, you could make the subsequent copies communicate with the first one, then exit. Detailed instructions for this are beyond the scope of this answer.

SLaks
+2  A: 

When you select multiple files in Explorer, your shell context menu extension's IShellExtInit::Initialize method will be called and pdtobj contains the selection. Note writing managed shell extension is not supported.

Sheng Jiang 蒋晟
Supported, smuportted. We don need no steenkin sport! ;-)
Sky Sanders
+1 for noting that writing a managed shell extension isn't supported.
Scott Smith
The latest .Net 4.0 runtime supports in process side-by-side loading of the .Net 4.0 runtime (and ALL future runtimes) with earlier .Net runtimes.See following excerpt from http://msdn.microsoft.com/en-us/magazine/ee819091.aspx "With the ability to have multiple runtimes in process with any other runtime, we can now offer general support for writing managed shell extensions—even those that run in-process with arbitrary applications on the machine."
logicnp
A: 

In order to do this reliably you would need to write a shell extension, most likely a sendto implementation.

I haven't written one since vb6 but you can find what looks to be a good managed example here

Or you could use a freeware utility

Sky Sanders