How to get commandline parameter from User
-
I want to get a parameter(for example "Path of Data") from user in commandline. How can I do it?
Hello Friends
Your Main method accepts a string array as a parameter. This contains what the user (or a shortcut) passed from the command line.
Cheers, Vıkram.
"if abusing me makes you a credible then i better give u the chance which didnt get in real" - Adnan Siddiqi.
-
I want to get a parameter(for example "Path of Data") from user in commandline. How can I do it?
Hello Friends
Please find below: public static void Main (string[] args) { if (args.Length > 0) { System.Console.WriteLine (args[0]); try { long number = long.Parse (args[0]); System.Console.WriteLine ("Number = " + number); } catch (System.FormatException e) { System.Console.WriteLine ("FormatException" + e); } return; } System.Console.WriteLine ("Please enter a number"); }
Cheers!! Brij
-
I want to get a parameter(for example "Path of Data") from user in commandline. How can I do it?
Hello Friends
There's this cunning command called
GetCommandLineArgs
in theEnvironment
class. This should help.Deja View - the feeling that you've seen this post before.