You are not logged in.
Is there a faster way of getting the dates for Creation and Access for a file than searching for the text through the DIR /T command? I know you can get the last written date by using the paramter %~t1 but you can't with Creation and Access unless you extract from the output of DIR /T. Just wondering if it's possible to get those other two dates by using a paramter like the time switch.
Thanks!
Offline
@ECHO OFF
ECHO.
SET /P FILENAME=Enter the filename that you wish to view its times.ÿ
IF "%FILENAME%"=="" GOTO :EOF
IF NOT EXIST .\%FILENAME% SET FILENAME= && GOTO :EOF
FOR /F "TOKENS=1-3 DELIMS= " %%A IN ('DIR .\%FILENAME% /T:C ^| FIND /I "%FILENAME%"') DO SET CREATION=%%A %%B %%C
FOR /F "TOKENS=1-3 DELIMS= " %%A IN ('DIR .\%FILENAME% /T:A ^| FIND /I "%FILENAME%"') DO SET ACCESS=%%A %%B %%C
FOR /F "TOKENS=1-3 DELIMS= " %%A IN ('DIR .\%FILENAME% /T:W ^| FIND /I "%FILENAME%"') DO SET WRITTEN=%%A %%B %%C
ECHO.
ECHO %FILENAME%
ECHO Creation = %CREATION%
ECHO Last Access = %ACCESS%
ECHO Last Written = %WRITTEN%
SET FILENAME=
SET CREATION=
SET ACCESS=
SET WRITTEN=
PAUSE > NUL:
Last edited by bleed (02 Nov 2007 08:56)
Offline
I think the only way to avoid using DIR like bleeds script is to make the jump to PowerShell
C:\PS>get-itemproperty C:\Test\myfile.doc | format-list
By the way, if you add SETLOCAL to the start of a script you avoid the need for all those SET statements to remove variables at the end.
Offline
PowerShell looks alright. Wonder what it can do... I might download it but for now I'll stick to what bleed's got goin' because I'm concentrating on portability.
Thanks for you help, guys!
Offline