Page 1 of 1

%~tI Expands %I to the date and time of file

Posted: 11 Aug 2010 05:41
by darioit
This attribute is used to expand date and time of file.

The time in this format is hh.mm

But if I prefer time in format hh.mm.ss how can I get this value?

Thanks in advance
Dario

Re: %~tI Expands %I to the date and time of file

Posted: 11 Aug 2010 07:26
by aGerman
Think you can't change the time format.
You could use a small included VBScript.

Code: Select all

@echo off &setlocal
set "file=c:\your\file\full\name.ext"

>"%temp%\tmp.vbs" echo WScript.Echo WScript.CreateObject("Scripting.FileSystemObject").GetFile(WScript.Arguments(0)).DateLastModified
for /f "delims=" %%a in ('cscript //nologo "%temp%\tmp.vbs" "%file%"') do set "DateTime=%%a"
del "%temp%\tmp.vbs"

echo %DateTime%
pause


Regards
aGerman