How do I run command line from Java code in the background?

前端 未结 3 2051
一向
一向 2021-01-02 11:53

I have the following line to run a batch file,

Process process = Runtime.getRuntime().exec(\"cmd /c start rake.bat\");

But I want it to ru

3条回答
  •  感情败类
    2021-01-02 12:21

    Process process = Runtime.getRuntime().exec("cmd /c start rake.bat");
    

    If you are calling the above line from a java process to execute the batch file. This will by default run in background.

提交回复
热议问题