V
V
VerniteAccount2016-12-20 23:41:57
Programming
VerniteAccount, 2016-12-20 23:41:57

[Solved] After inserting a value from an array, the second part of the string disappears without a trace, how to insert it correctly?

Good day. Trimmed (the substring " RIN="+ value
" disappears without a trace from the startInfo.Arguments string, while in the absence of ED, RIN and value appear.

string ED = WL[NW.SelectedIndex][0];
foreach (string value in WD.Lines) {
startInfo.Arguments = "MainD=IDD ID="+ ED +" RIN="+ value;
}

UPD
ConsoleProgram.exe VPN Action=pptp SIP=19216801 KEY=123456
When you run the program with these arguments, using cmd everything starts and works as it should. There are no errors in the launch line, there are no "-" and "/" signs either.
I'm learning C#, I'm writing test software for practice purposes, please don't kick too much.
UPD Solved the problem, removed unreadable (\n\r\t) characters from the string, everything works like clockwork.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-12-21
@senal

I don't see the argument names, which are usually specified using "-" or "/".
Perhaps it should be:
startInfo.Arguments = "-MainD IDD -ID "+ ED +" -RIN "+ value;
If this is a single argument, then you need to remember that spaces are considered separators between multiple arguments and a single argument that includes spaces must be enclosed in quotes, which we do not forget to escape:
startInfo.Arguments = "-someKey \"MainD=IDD ID="+ ED +" RIN="+ value + "\"";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question