/*
* Created on 2006-5-27
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.zeng;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class TestCmd {
public static void main(String[] args) throws Exception {
try{
String cmd = "cmd.exe /c \"mkdir d:\\temp\\005\"";
//可去掉一组引号"cmd.exe /c mkdir d:\\temp\\005";
//cmd.exe /c为固定格式,mkdir d:\\temp\\005是DOS命令,
//此命令在D盘创建一个目录d:\temp\005
Runtime.getRuntime().exec(cmd);
}catch(Exception e){
e.printStackTrace();
}
}
}