代码下载地址:http://www.zuidaima.com/share/1550463260150784.htm
package com.zuidaima.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * * @author zuidaima.com * */ public class GetFileCreationDate { public static void main(String[] args) { try { Process proc = Runtime.getRuntime().exec( "cmd /c dir c:\\zuidaima_com_logfile.log /tc"); BufferedReader br = new BufferedReader(new InputStreamReader( proc.getInputStream())); String data = ""; // it's quite stupid but work for (int i = 0; i < 6; i++) { data = br.readLine(); } System.out.println("Extracted value : " + data); // split by space StringTokenizer st = new StringTokenizer(data); String date = st.nextToken();// Get date String time = st.nextToken();// Get time System.out.println("Creation Date : " + date); System.out.println("Creation Time : " + time); } catch (IOException e) { e.printStackTrace(); } } }标签: java windows bat 创建时间话题: 文本解析和文件处理 脚本和工具
java运行bat命令得到某个windows文件的创建时间,布布扣,bubuko.com
原文:http://blog.csdn.net/yaerfeng/article/details/37735883