如何在批处理文件运行时在HTML文件中显示进度条
我已经编写了一个如何在批处理文件运行时在HTML文件中显示进度条,html,batch-file,progress-bar,Html,Batch File,Progress Bar,我已经编写了一个Servlet来运行bat文件。此bat文件从指定路径复制内容,然后重新启动服务器。我想在html页面中向最终用户显示进度条,即批处理文件进度,即,进度条应在文件复制时进行,并应显示复制完成后服务器启动并重新启动服务器 这是我的密码: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Servlet
来运行bat文件。此bat文件从指定路径复制内容,然后重新启动服务器。我想在html页面中向最终用户显示进度条,即批处理文件进度,即,进度条应在文件复制时进行,并应显示复制完成后服务器启动并重新启动服务器
这是我的密码:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("DoPost is Invoked");
String buildPath = request.getParameter("buildPath");
System.out.println(buildPath);
try {
File file = new File("C:/Users/Hrushi/Desktop/Html/BuildPath.txt");
FileWriter fileWriter = new FileWriter(file);
fileWriter.write(buildPath);
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
Runtime.getRuntime().exec("cmd /c start C:/Users/Hrushi/Desktop/Helllo/hello.bat");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
}
看看这个例子,用vbscript和HTA==>创建一个进度条看看这个例子,用vbscript和HTA==>