Java调用.bat脚本

时间:2020-08-04 23:58:26   收藏:0   阅读:96

import java.io.;
import java.util.
;

public class TestExec {
public void runbat(int timeFortmat) {
String cmd = "cmd /c start D:/ScheduleRun/data/"+timeFortmat+".bat";

    try {
        Process ps = Runtime.getRuntime().exec(cmd);
        System.out.println(ps.getInputStream());
    } catch(IOException ioe) {
        ioe.printStackTrace();
    }
}          

public static void main(String[] args){
       TestExec  test1 = new TestExec ();           
       test1.runbat(1340);
}

}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!