0

I am calling one .NET app from another using Process.Start and passing in a bunch of strings as command line arguments:

startInfo.Arguments = String.Join("""  """, MyArray)
Dim p As Process = Process.Start(startInfo)

My intent is to pass in something like:

"first value" "second value" "third value"

and retrieve from within the second app:

Sub Main(ByVal args() as String)
    If args.Length > 0 Then

    End If
    ...
End Sub

Unfortunately args.Length only returns 1 - all the values I pass get passed on as a single value: "first value second value third value"

I tried wrapping each in double quotes in the first app but does not seem to help. I know I can just retrieve args(0) and then split it into an array of values but I do not want to do that. Also somehow it worked for me before, even without double quotes. So I am trying to figure out what happened and how can I make it pass my strings as multiple values instead of 1.

1 Answer 1

2

Your String.Join is not going to give you what you want. It will not put the double quote at the start and end of the string.

startInfo.Arguments = """" + String.Join(""" """, MyArray) + """"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.