How to pass all selected files names to C# application?

I would like to select several files on my desktop (or any other folder) and pass their names to my application.

More specifically, I've added a key to the registry such that when I right click on a jpeg file I see a new "Transform" option that actually runs my application. The question is how can I pass all selected files names to my application ?

Thanks a lot !

Answers


They should be passed by windows. Look at the command line arguments passed to your application at start up. ie. in your Main function that has a parameter of string[] args.

To illustrate:

static void Main(string[] args)
{
    if (args.Length == 0)
    {
        Console.WriteLine("Program called without arguments");
    }
    else
    {
        Console.WriteLine("Program received this arguments:");
        foreach (string arg in args)
        {
            Console.WriteLine("\t{0}", arg);
        }
    }

    // .. do other stuff
}

Need Your Help

how to catch the MultipleObjectsReturned error in django

python django exception

Is it possible to catch the MultipleObjectsReturned error in Django?

why http proxy is host+port

proxy internet-explorer http-proxy

In IE when I configure http proxy I need to give host+port and not full url.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.