Home All Groups Group Topic Archive Search About

Command Line Arguments

Author
4 Dec 2006 4:47 PM
Milan
Hi,

Please guide me how to set command line argument and
how to retrive command line argument.

Senario: vb.net application should be able to execute from command
prompt by passing login and password and should be able to execute
process form (with his parameter)
User should not be able to see GUI

Milan

Author
4 Dec 2006 5:09 PM
Tim Patrick
Visual Basic includes a "Command" function that provides all command-line
arguments as an entire string. In VB2005, you can also use the My.Application.CommandLineArgs
property, which provides a collection of the individual arguments.

When running your program within Visual Studio, you can set temporary command-line
arguments through the Project Properties form. Choose the Debug tab, and
then fill in the "Command line arguments" field as needed.

-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005

Show quoteHide quote
> Hi,
>
> Please guide me how to set command line argument and how to retrive
> command line argument.
>
> Senario: vb.net application should be able to execute from command
> prompt by passing login and password and should be able to execute
> process form (with his parameter)
> User should not be able to see GUI
> Milan
>
Author
4 Dec 2006 8:32 PM
Herfried K. Wagner [MVP]
"Milan" <milanwa***@googlemail.com> schrieb:
> Please guide me how to set command line argument and
> how to retrive command line argument.
>
> Senario: vb.net application should be able to execute from command
> prompt by passing login and password and should be able to execute
> process form (with his parameter)
> User should not be able to see GUI

Select 'Sub Main' in the project's properties as startup object and add this
code to your project:

\\\
Public Module Program
    Public Sub Main(ByVal Args() As String)
        If Args.Length > 0 Then
            If ... Then
                Application.Run(New MainForm())
            Else
                ...
            End If
        Else
            ...
        End If
    End Sub
End Module
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>