try every thing, code does nothing

jorge

Well-known member
Joined
Jul 13, 2003
Messages
239
Location
Belgium
ok il trying to loop trou all argument and if it one of them meets the requirement doe x with it so here my code
Code:
        Dim i
        For i = 0 To Environment.GetCommandLineArgs.GetUpperBound(0) - 1
            If Environment.GetCommandLineArgs(i).ToLower().StartsWith("f=") Then
                Dim sLen As String = Environment.GetCommandLineArgs(i).Length - 2
                sPath = Environment.GetCommandLineArgs(i).Substring(2, sLen)
            End If
        Next i
it does nothing but i start with: pit.exe f="c:\images"
does someone have anyid whats wrong?
 
Change this line:

[VB]
For i = 0 To Environment.GetCommandLineArgs.GetUpperBound(0) - 1
[/VB]

to

[VB]
For i = 0 To (Environment.GetCommandLineArgs.Length() - 1)
[/VB]
 
Take a look at the 4th line:
Dim sLen As String = Environment.GetCommandLineArgs(i).Length - 2

Dont you suppose to declare sLen as integer instead of String?
 
Back
Top