Executing cmd.exe commands from Java

前端 未结 1 1085
北荒
北荒 2020-12-03 07:53

I\'m trying to read a file from the user, in which each line is a cmd.exe command, and run it (it\'s okay to assume the commands are legal), but when I give a c

相关标签:
1条回答
  • 2020-12-03 08:19

    That's because echo is not an external executable command (i.e., there is no echo.exe file on your hard disk, unless you put it there yourself). It's an internal command of the shell.

    You'll probably find that you need to execute something like:

    cmd.exe /c echo hello
    
    0 讨论(0)
提交回复
热议问题