Exe with arguments
hi everybody,
I am suppose to create a exe. This particular exe will be used by java developers so what i need to do is to build this exe in such a way that when i run that exe from command prompt with argument it should execute and the o/p or results to be in a file.
For some processing i need yo use ocx so i am not able to use the console type of application. I use this windows application project type.
Note: I know how to use a ocx n reading and writing to a file. I just need some code snippet of how to create such a exe that will take argument and execute
Eg: ExeName arguments.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Scott LysleRank #49 · 31K reputationPosted Jan 22, 2007, 8:27 PM EST
static void Main(string[] args)
{
for(int i=0; i
string filePath;
filePath = args[i].ToString();
// do something with the filePath (or whatever was passed in)...
You can also collect the command line arguments using Environment.GetCommandLineArgs() if you need the args elsewhere in the application.
swatantra singh55 reputationPosted Jan 22, 2007, 9:10 PM EST