Tried that. It splits on spaces then.

I think I got it though.

I changed the for loop above to this
VB Code:
  1. For c As Integer = 0 to CmdArgs.Length - 1
  2.    If CmdArgs(c).IndexOf(" ") > -1 Then
  3.        arg &= """""""""" & CmdArgs(c) & """""" & " "
  4.    Else
  5.        arg &= """" & CmdArgs(c) & """" & " "
  6.    End If
  7. Next

What I don't like about this method is that if the argument has spaces it is passed with quotes around it. I would really prefer not to have that. But I can't get it to work any other way.