How to execute cmd commands via Java

前端 未结 11 2172
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 13:59

I am trying to execute command line arguments via Java. For example:

// Execute command
String command = \"cmd /c start cmd.exe\";
Process child = Runtime.ge         


        
11条回答
  •  一生所求
    2020-11-22 14:53

    As i also faced the same problem and because some people here commented that the solution wasn't working for them, here's the link to the post where a working solution has been found.

    https://stackoverflow.com/a/24406721/3751590

    Also see the "Update" in the best answer for using Cygwin terminal

提交回复
热议问题