如何在Java中执行本机命令? [英] How To Execute Native Commands In Java?
本文介绍了如何在Java中执行本机命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何通过Runtime.getRuntime()。exec(command)执行命令并处理输出,但这是非常有限的。
I know very well how to execute commands via Runtime.getRuntime().exec(command) and handle the output, but this is VERY limited.
如何执行'echo','cd','md','rd'等命令。
How can I execute commands like 'echo', 'cd', 'md', 'rd', and any other command rooted inside of the cmd.exe through ProcessBuilder (or whatever class) in Java?
推荐答案
你只需调用
这篇关于如何在Java中执行本机命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文