调用系统命令实现删除文件的操作,java调用系统命令实现删除文件的操作
Runtime.getRuntime().exec("del C:\\temp.txt"); public class CmdDelFile {public static void main(String[] args) {try { String[] cmdArray = {"cmd", "/c", "del", "C:\\Temp\\temp.txt"}; Runtime.getRuntime().exec(cmdArray);} catch (Exception e) { e.printStackTrace();}}} 转自:http://www.cjsdn.net/post/view?bid=1&sty=0&id=180886黑色头发 http://heisetoufa.iteye.com
如果发现本文有误,欢迎批评指正
页:
[1]