隨筆-46  評論-54  文章-0  trackbacks-0

          原帖:http://chenyaqiong81081.blog.163.com/blog/static/44622594200791235256255/

          一、Runtime.getRuntime().exec()執(zhí)行命令情況:
                 Runtime.getRuntime().exec("cmd /c your command")//2000
                 Runtime.getRuntime().exec("command /c your command")//98
                 Runtime.getRuntime().exec("sh/ your command")//linux

          二、執(zhí)行.sh文件的情況:
                1、把命令寫成a.sh ;執(zhí)行命令的時候
                     Process child = Runtime.getRuntime().exec("bash a.sh,null,new File("http://usr/local/mysql/bin/"));
                     child.waitFor();
                     ........
                 2、Process child = Runtime.getRuntime().

                                                    exec(new String[] {"/bin/sh","-c","mysqldump -u root -p7788919 axtic_cg" },

                                                             null,
                                                             new File("/usr/local/mysql/bin/"));
                      child.waitFor();

                      注:waitFor()等待操作完成

          posted on 2009-12-29 17:10 rox 閱讀(2876) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 本溪市| 江陵县| 砀山县| 广饶县| 新兴县| 天峨县| 涪陵区| 花垣县| 玉树县| 大理市| 中牟县| 皋兰县| 塘沽区| 德安县| 化州市| 拜城县| 印江| 当涂县| 团风县| 武宣县| 福泉市| 锦屏县| 武邑县| 壶关县| 开原市| 张家港市| 广水市| 红安县| 新泰市| 资溪县| 奎屯市| 乌什县| 漯河市| 大同县| 普格县| 泰来县| 大竹县| 卓尼县| 监利县| 黄大仙区| 江油市|