A
A
Alexander Borisovich2016-04-06 15:12:39
cmd/bat
Alexander Borisovich, 2016-04-06 15:12:39

Why doesn't Process.Start in c# want to eat a command line parameter?

There is an exe launched from c#. She has a set of options.
Command line options like -z are eaten, but if you add after the "-z" option " -dg 2 " crashes with an invalid character error. Everything is separated by spaces. Parameters do not merge.

var process = new Process {
                       StartInfo = new ProcessStartInfo {
                           FileName = ".\\work.exe",
                           Arguments = @"-z  " + beta ,
                           UseShellExecute = false,
                           RedirectStandardOutput = true,
                           CreateNoWindow = false
                       }
                    };
process.Start();

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MazaHackaa, 2016-04-06
@MazaHackaa

Try to pass the arguments along with FileName
I didn’t accept it either, in my opinion I solved the problem by passing them with the address, but I don’t remember exactly

D
Dmitry Eremin, 2016-04-06
@EreminD

anyway, it should be transmitted. What is in the beta?

A
Alexander Ananiev, 2016-04-06
@SaNNy32

stackoverflow.com/questions/15061854/how-to-pass-m...
Does the program itself interpret the arguments correctly?
And yes, it would not hurt to give the error code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question