Tell me how you can find out the date the file was created in BAT. We have a variable for %%~ti, but it only indicates the file's modification date. And how do you know it is the date the file was created?
2 Answers
@echo off
for /f "skip=5 tokens=1,2 delims= " %%a in ('dir /a-d /tc "%~1"') do (
echo Date: %%a, Time: %%b, File: %~1
exit /b 0
)
At least these three options exist, which are all scriptable.
There can be limitations depending on the OS version, and the language, and characters being used.
- Powershell
- WMIC
- VBS script using WSH
FINDSTR /E "%~1"
?