I'm trying to pass a folder path via commandline argument to an application.
Problem: my folder path contains space " "
in it's string. When I read the commandline arguments in the application I get my path chopped into pieces on the space " "
Sub Main()
Dim arguments As String() = System.Environment.GetCommandLineArgs()
For Each Arg As String In arguments
Console.WriteLine("Argument : " & Arg)
Next
Console.ReadLine()
End Sub
Edit: added code to build my argument
Private Sub btn_Copy_Click(sender As Object, e As EventArgs) Handles btn_Copy.Click
Dim args(3) As String
args(0) = """" & tb_CopyFromPath.Text & """"
args(1) = """" & tb_CopyToPath.Text & """"
args(2) = """" & tb_ItemTag.Text & """"
args(3) = """" & tb_Prefix.Text & """"
Dim argument As String
argument = args(0) & " " & args(1) & " " & args(2) & " " & args(3)
Process.Start("J:\VB.NET - EM AddIn\EM_Design_AddIn\CopyDesign\bin\Debug\CopyDesign.exe", argument)
End Sub
This result isn't okay. The first argument of the first path now contains a piece of the second path.
Edit: add value result from debug.
"""C:\VaultWorkspace\cadcampc\03-Vessel configurator - R2.0\Nozzles\WN_RF_ASME_B16.5\"" ""C:\VaultWorkspace\cadcampc\03-Vessel configurator - R2.0\Test Copy Design\N03"" ""N3"" ""12345-3"""