java下运行windows命令行程序(批处理文件)示例

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*, java.lang.*, java.io.*" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<body>
<div>
       <%
 File file = new File("Y:\\CV\\normal\\BENCHTALENT_RESUME");
       if (!file.exists()) {
        out.println("the directory of " + "Y:\\CV\\normal\\BENCHTALENT_RESUME" + " doesn't exists.<br/>");
        Runtime.getRuntime().exec("cmd /c start c:\\mapDriver.bat");
       }
       else
       {
        out.println("the directory of " + "Y:\\CV\\normal\\BENCHTALENT_RESUME" + " is ok.<br/>"); 
       }
%>
</div>

</body>
</html>

 

你可能感兴趣的:(windows)