0

I want to know how to get number of files selected by mouse and throw it to args. so far I know "%1" used to know file path.

static void main (string[] args)
{
    string a = args[?] --> number of files selected
}
Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135

2 Answers2

0

Could you be more specific?

First of all a static void main method is usually reserved for the start point of any .Net application. As explained in MSDN: "The Main method is the entry point of your program, where you create objects and invoke other methods. There can only be one entry point in a C# program."

Hence I find it hard to see how files selected by a mouse would be used here.

The args parameter is used for arguments entered when running the .exe of the application. As explained in MSDN: "The parameter of the Main method is a String array that represents the command-line arguments. Usually you check for the existence of the arguments by testing the Length property"

Command Line Arguments

For example: "DoWork.exe foo bar" In your application will resolve to args[0] = "foo" and args1 = "bar"

JarJarrr
  • 400
  • 3
  • 18
  • i selected files on windows explorer, right click the files and choose my application to process those files... but how if i want to tell my application how many files i selected on windows explorer... on command-line arguments i write "C://myapplication.exe" "%1" ... – servasius May 03 '11 at 15:32
0

Number of arguments

args.Count()

The result for test.ext 1.txt hello.txt pay.txt is 3

Go here if you mean manage files that has dragged to the application Window

Community
  • 1
  • 1
Saleh
  • 2,982
  • 5
  • 34
  • 59