vb.net How to pass a string with spaces to the command line

后端 未结 6 1759
轻奢々
轻奢々 2020-12-11 23:02

I am trying to call an external program using Process:

    Dim strExe As String = \"E:\\Projects\\Common Files\\mktorrent.exe\"
    Dim p As New Process
             


        
6条回答
  •  天命终不由人
    2020-12-11 23:04

    It's really an old - but unsolved - problem. My 2 cents of contribution.

    Use CHR(34) before-and-after the string, delimiting it like:

    Arg = "Name=" & chr(34) & "John Doe da Silva" & chr(34)

    Just it!

提交回复
热议问题