Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I display the time stamp of a file with seconds,

(creation date/time, modified date/time, and access date/time. All, with seconds).

from the command line?

share|improve this question
    
What an interesting question - 3 years without upvotes. – boboes Jun 27 at 7:34
    
@boboes if you thought this one was interesting, you should check out this one! superuser.com/questions/973547/… – barlop Jun 27 at 9:13
    
on a different note, the question here may be relevant to the problem and answer here superuser.com/questions/588608/… in that perhaps in certain cases according to the answer there, robocopy might take seconds into account, in which case, this question that shows seconds, is particularly relevant. – barlop Jun 27 at 9:14
up vote 2 down vote accepted

You could use PowerShell to get that information.

  1. Start PowerShell from the startmenu
  2. Use:

Get-ChildItem <<File or Folder>> -Force | Select-Object FullName, CreationTime, LastAccessTime, LastWriteTime, Mode, Length

It will print out the information for you. -Force is used to get items that cannot otherwise be accessed by the user, such as hidden or system files. Additionally you can use the -Recurse option to recurse into folders.

--------- //added by barlop

PS C:\Users\user> Get-ChildItem c:\q\az.png -Force | Select-Object FullName, CreationTime, LastAccessTime, LastWriteTime
, Mode, Length


FullName       : C:\q\az.png
CreationTime   : Sun 28 Apr 2013 12:12:59
LastAccessTime : Sun 28 Apr 2013 12:12:59
LastWriteTime  : Tue 22 Jul 2008 05:01:47
Mode           : -a---
Length         : 79248

PS C:\Users\user>

-------------- // end added by barlop

An easy way to recurse into folders and have a file that can be imported into Excel is to use:

Get-ChildItem C:\ProjectX -Force -Recurse | Select-Object FullName, CreationTime, LastAccessTime, LastWriteTime, Mode, Length | Export-Csv c:\temp\ProjectX_files.csv

//pic added by barlop
enter image description here

share|improve this answer
E:\blah>cscript //nologo filetimes.vbs a.a
Times for file: E:\blah\a.a
Created:  15/12/2014 2:04:22 AM
Modified: 31/05/2016 10:42:31 PM
Accessed: 15/12/2014 2:04:22 AM

contrast with

E:\blah>dir a.a
31/05/2016  10:42 PM            26,990 a.a

(dir only shows one time at a time, e.g. /tw by default, or /tc or /ta can write /t:w e.t.c. see dir /? for other info)

So that vbscript file shows 3 times and seconds and in one command.

Set objFSO = CreateObject("Scripting.FileSystemObject") 

if WScript.Arguments.Count = 0  Then
   WScript.Quit
End If

strfileFolder = objFSO.GetAbsolutePathName(WScript.Arguments(0)) 

'this line only works with cscript

WScript.StdOut.WriteLine "Times for file: " & strfileFolder

Set v = objFSO.GetFile(WScript.Arguments(0))
dm=v.DateLastModified
dc=v.DateCreated
da=v.DateLastAccessed
WScript.StdOut.WriteLine("Created:  "&dc)
WScript.StdOut.WriteLine("Modified: "&dm)
WScript.StdOut.WriteLine("Accessed: "&da)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.