Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing a string to the Windows command line

Please see the code below

Runtime rt = Runtime.getRuntime();  
rt.exec("cmd /c start");
String[] cmd = {"LogParser", "Select top 10 * into c:\temp\test9.csv from application" };
rt.exec(cmd);

It opens the command window but the strings are not passed in after opening. Can someone tell me why this code won't place the strings into the command window?

like image 447
user2065481 Avatar asked Oct 21 '22 16:10

user2065481


1 Answers

The option /C means: Carries out the command specified by the string and then terminates.

So the other command is handled as a separated one.

like image 77
CloudyMarble Avatar answered Oct 24 '22 11:10

CloudyMarble