| Hi,
We can use the "Arguments" property in [b]ProcessStartInfo[/b] class for passing parameters to start a new application. Check the following,
[code]System.Diagnostics.ProcessStartInfo processStart = new System.Diagnostics.ProcessStartInfo("myApp.exe");
processStart.Arguments = "aruguments";
Process.Start(processStart);[/code]
We can change the main() method to accept the string[] arguments/parameters as follows,
[code]static void Main(string[] args)
{
if (args.Length > 0)
{
Console.Write("args length: " + args.Length.ToString());
Console.Write("\n\n");
foreach (string singleArg in args)
{
Console.WriteLine(singleArg);
}
}
else
{
Console.WriteLine("No args !");
}
}[/code]
Otherwise you can use the [b]Environment.GetCommandLineArgs();[/b] for returns a string[] array of arguments given to the application.
[color=#800080][b]...S.VinothkumaR.[/b][/color]
[url]http://vinothnat.blogspot.com[/url] | |