Command line argument??

jorge

Well-known member
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 cant use it?
whats wrong?

thanx in advance

Jorge
 
Code:
        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
Code:
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.
 
If you use MessageBox.Show (System.Environment.CommandLine) what does it display?
Also try and display System.Environment.CommandLineArgs (0) and (1)
 
Back
Top