Command line argument??

jorge

Junior Contributor
Joined
Jul 13, 2003
Messages
239
Location
Belgium
ok,
My startup object is sub main,
here is what i want, if my.exe -server is started it would display a msg box, if my.exe is started it schould continue loading.
buti t says command() is private so i can't use it?
whats wrong?

thanx in advance

Jorge
 
Visual Basic:
        Dim sCommand As String = System.Environment.CommandLine
        sCommand = sCommand.ToLower()
        If sCommand = "-server" Then
            Call remote()
            Exit Sub
        End If
that my code, but it does nothing, it doe not go to remote!
 
try
Visual Basic:
Dim sCommand As String = System.Environment.GetCommandLineArgs(1)
        sCommand = sCommand.ToLower()
        If sCommand = "-server" Then
            Call remote()
            Exit Sub
        End If

instead - System.Environment.CommandLine returns the entire command line including the path to the application.
GetCommandLineArgs() splits the commandline into an array of seperate arguments with index 0 being the application.
 
Back
Top