java java调用bat文件一个bat文件后如何判断该bat文件执行完毕?

java调用cmd并执行批处理(bat)文件
String commandText = &cmd /c start D:/index.html&; //String commandText = &cmd /c start osk&;try {Runtime.getRuntime().exec(commandText);} catch (IOException e) {// TODO Auto-g...
String commandText = "cmd /c start D:/index.html";
//String commandText = "cmd /c start osk";
Runtime.getRuntime().exec(commandText);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(1529)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_095069',
blogTitle:'在bat中执行java文件,并传递参数的用法',
blogAbstract:'以下是在一个bat 文件,\r\n@echo 数据全量抽取系统@echo offset/p locale=请输入进行全量抽取的地市:set/p cb=请输入进行全量抽取的系统:set/p table=请输入进行全量抽取的表:cd D:\\workspace\\cdpd:java -Djava.ext.dirs=D:\\workspace\\cdp\\WEB-INF\\lib -cp .\\WEB-INF\\classes com.nci.etl.FullExtract %locale% %cb% %table% pause\r\n&\r\n通过执行的上面的bat的文件,可以执行项目中的特定的类,并且可以通过命令行传递参数。',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:7,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}java调用cmd并执行批处理(bat)文件
String commandText = &cmd /c start D:/index.html&;
//String commandText = &cmd /c start osk&;
&&Runtime.getRuntime().exec(commandText);
&} catch (IOException e) {
&&// TODO Auto-generated catch block
&&e.printStackTrace();9703人阅读
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(<span style="COLOR: #40);&&&&}}&&&&&
&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:75669次
积分:1030
积分:1030
排名:千里之外
原创:25篇
评论:10条
(1)(1)(1)(1)(1)(2)(1)(1)(1)(3)(2)(1)(5)(3)(2)Java开子进程调用一个bat文件,bat文件里的cd命令无效怎么处理 - J2SE当前位置:& &&&Java开子进程调用一个bat文件,bat文件里的cd命令无Java开子进程调用一个bat文件,bat文件里的cd命令无效怎么处理&&网友分享于:&&浏览:82次Java开子进程调用一个bat文件,bat文件里的cd命令无效怎么办?Java使用runTime类,开子进程调用一个bat文件,
但是bat文件里的cd命令不能正常执行怎么办?------最佳解决方案--------------------你确定直接执行bat文件可以?------其他解决方案--------------------奥,刚刚调查的原因不对,cd命令可以识别,是因为切换了盘符才报错了
cd&E:\mytest\
call&myrun.
修改成下面这样就行了----&
cd&E:\mytest\
call&myrun.
。不过还是要谢谢楼上的。
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有

我要回帖

更多关于 java远程调用bat脚本 的文章

 

随机推荐