Link to home
Create AccountLog in
Visual Basic.NET

Visual Basic.NET

--

Questions

--

Followers

Top Experts

Avatar of SETP
SETP

Command Line Arguments
How can I read the command line arguments that a VB.NET 2003 program is launched with? For example, if I have a program call "SuperCalc.exe" and it is run as follows:

"SuperCalc.exe /r"

How can I detect from code that the command-line argument "/r" was used?

Thanks

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of flavoflavo🇦🇺

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of arif_eqbalarif_eqbal

Yes flavo you are right,

There's another way however which is this

Dim Str() As String = Environment.GetCommandLineArgs()
if Str(1) = "/r" then
  'Do Something
End If

Here you need not Split as we get an array anyway

the following is a good article on this topic

http://www.devx.com/dotnet/Article/10115/1763

Avatar of SETPSETP

ASKER

Thanks! Didn;t know there was an Environment class. Nice...

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of flavoflavo🇦🇺

Glad to help once again :-)

Dave
Visual Basic.NET

Visual Basic.NET

--

Questions

--

Followers

Top Experts

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,