The proper format to have that line should be:
Code:
"""C:\Documents and Settings\something.exe"" -a -t -k -v"
Thus resulting into a string: "C:\Documents and Settings\something.exe -a -t -k -v
Windows always adds quotes around a filepath if it contains spaces. This is also true for parameters passed to the program. Now this allows us to use a QuoteSplit:
Code:
Public Function QuoteSplit(ByRef Expression As String, Optional ByRef Delimiter As String = " ", Optional ByVal Compare As VbCompareMethod = vbBinaryCompare) As String()
Dim sParts() As String, N As Long
sParts = Split(Expression, """")
For N = 0 To UBound(sParts) Step 2
sParts(N) = Replace(sParts(N), Delimiter, Delimiter & vbNullChar, , , Compare)
Next N
QuoteSplit = Split(Join(sParts, """"), Delimiter & vbNullChar)
End Function
And an usage example:
Code:
Dim Parameters() As String
Parameters = QuoteSplit("""C:\Documents and Settings\something.exe"" -a -t -k -v")
' now Parameters contains the following items:
Parameters(0) = """C:\Documents and Settings\something.exe"""
Parameters(1) = "-a"
Parameters(2) = "-t"
Parameters(3) = "-k"
Parameters(4) = "-v"
And this should make your life easier