command line arguments

  • Thread starter Thread starter James
  • Start date Start date
J

James

vb.net 2003

i created console.exe file and from cmd prompt i would like to pass
arguments into it.

Eg myprogram.exe ntid

myprogram.exe expects to read a variable enter by user. How do i pass
arguments to be read by my program ? The below only display it and not
reading a variable

Dim arguments As [String]() = Environment.GetCommandLineArgs()

Console.WriteLine("GetCommandLineArgs: {0}", [String].Join(", ", arguments))
 
James said:
i created console.exe file and from cmd prompt i would like to pass
arguments into it.

Eg myprogram.exe ntid

myprogram.exe expects to read a variable enter by user. How do i pass
arguments to be read by my program ? The below only display it and not
reading a variable

What do you mean by "reading a variable"?!
 
i created console.exe file and from cmd prompt i would like to pass
arguments into it.

Eg myprogram.exe ntid

Try this :

Public Argument1 as String = Nothing

Function Main( ByVal saArgs as String() ) as Integer
Argument1 = saArgs( 0 )
. . .
End Function

HTH,
Phill W.
 
I believe, it's so that the Main function can return a value to the calling
process/DOS window/whatever ran the exe...
____________________________________
The Grim Reaper
 
The Grim Reaper said:
I believe, it's so that the Main function can return a value to the calling
process/DOS window/whatever ran the exe...

That's true.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top