cmd - How to execute a command line in C# -


i have problem executing command line in c#:

screenshot

i try:

string mon_cmd=@"c:\windows\system32>consoletest.exe --asmrz c:\temp\test_cmd\image.jpg c:\temp\test_cmd\";  system.diagnostics.process.start("cmd.exe", @"/c ' mon_cmd'"); 

but error.

how can execute exact command?

provided consoletest.exe in c:\windows\system32 (which not seem idea that's topic)

string mon_cmd = @"c:\windows\system32\consoletest.exe"; string arguments = @"--asmrz c:\temp\test_cmd\image.jpg c:\temp\test_cmd\";  system.diagnostics.process.start(mon_cmd, arguments); 

should job

and suggested cfrozendeath , nyerguds, if want use mon_cmd in string, have several options such as: build new string using + operator, stringbuilder or if on c#6 string interpolation:

string arguments = $"/c ' {mon_cmd}'"; 

(and don't need verbatim string one)


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -