Runtime.getRuntime().exec("命令行");

解决方案 »

  1.   

    Runtime.getRuntime().exec("del ss.bat"); 怎么就不执行?
      

  2.   

    比如你写一个index.java程序,其功能是将当前目录中的SN.txt拷贝成SN1.txt,
    代码如下:
    /**
    index.java(其中没有处理异常!)
    其中,这个程序运行在Windwos 2000上!
    */
    public class index
    {
      public static void main(String[] args)
      {
       try
       {
          Process proc=Runtime.getRuntime().exec(
                    "cmd /c copy  SN.txt SN1.txt");
        }
       catch(Exception e)
       {}
       }
    }
    /**
    祝好运!
    /*
      

  3.   

    今天刚刚发现Runtime这个类,原来妙用无穷。
      

  4.   

    :worldheart(冰力十足) 
    说的对!
      

  5.   

    Runtime.getRuntime().exec("cmd /c ping aaa")怎么就运行不起来呢?
    而 Runtime.getRuntime().exec("cmd /c del ss.bat")就可以运行;