The parameter given in the command line is the command line parameter.
Command line parameters are separated by spaces.
However, if the command line parameter itself contains spaces, the parameter must be enclosed in a pair of double quotation marks.
Eg: d: \ loading.exe-t = 5000
// Program. cs
Static class Program {////// Main entry point of the application. ///Static void Main (string [] args) {Application. EnableVisualStyles (); Application. SetCompatibleTextRenderingDefault (false); Application. Run (new WelCome (args ));}}
// Obtain the program
////// Configure ///Public WelCome (string [] args) {InitializeComponent (); foreach (string arg in args) {// The passed parameter-t is the time when the form is displayed if (arg. contains ("-t =") {string strTime = arg. substring (arg. indexOf ('=') + 1); int time = 200; if (int. tryParse (strTime, out time) {this. kltimer. interval = time ;}}}}
Summary:
Use the main program entry that can pass a string array. The characters in the array are the command line parameters.
Windows + r enter exepath args1 args2 to run