Files dropped upon program shortcut/executable

Feb 2, 2011 at 5:15 AM

Hi,

How can i configure the CommandLine Parser Library to support the following scenarios:

1. The User drops a file (he wishes to be opened) onto a shortcut/executable.

2.The user drops multiple files onto a shortcut/executable.

 

I'm asking because for the first scenario the FileArgument requires something like --file="c:\myfile.txt" and when a file is dropped you receive only "c:\myfile.txt"

And for the second scenario something like :

[ValueArgument(typeof(string[]), 'f', "files", Description="Input from multiple files")]
public string[] InputFiles;

 

TIA,

Koby Meir

Coordinator
Feb 21, 2011 at 5:56 PM

You can use additional arguments for this. But be sure to update first I had to made a small change tu support multiple values.

 

FileArgument f = new FileArgument('X');
f.AllowMultiple = true;
f.Optional = true;
parser.AdditionalArgumentsSettings.AcceptAdditionalArguments = true;
parser.AdditionalArgumentsSettings.TypedAdditionalArguments.Add(f);