Visual Basic.NET
--
Questions
--
Followers
Top Experts
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
"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
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Yes flavo you are right,
There's another way however which is this
Dim Str() As String = Environment.GetCommandLine Args()
if Str(1) = "/r" then
 'Do Something
End If
Here you need not Split as we get an array anyway
There's another way however which is this
Dim Str() As String = Environment.GetCommandLine
if Str(1) = "/r" then
 'Do Something
End If
Here you need not Split as we get an array anyway
Thanks! Didn;t know there was an Environment class. Nice...






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Glad to help once again :-)
Dave
Dave
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,