首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > windows >

windows上取到具体时间的程序

2012-09-28 
windows下取到具体时间的程序package com.wanda.sso.client.servletimport java.io.BufferedReaderimpor

windows下取到具体时间的程序

package com.wanda.sso.client.servlet;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
?* 以下给出一个windows下取到具体时间的程序:
?*
?* @author iSoftStone
?*/
public class FirstTest {

?/** Creates a new instance of FirstTest */
?public FirstTest() {
?}

?public static void main(String[] args) {
??try {
???Process p = Runtime.getRuntime().exec(
?????"cmd /C dir D:\\workspace\\ssoClient\\WEB-INF\\Setting.xml /tc");
???InputStream is = p.getInputStream();
???BufferedReader br = new BufferedReader(new InputStreamReader(is));
???String str;
???int i = 0;
???while ((str = br.readLine()) != null) {
????i++;
????if (i == 6) {
?????System.out.println(str.substring(0, 17));
????}
???}

??} catch (java.io.IOException exc) {
???exc.printStackTrace();
??}
?}
}

热点排行