Singularity303
Singularity303

Reputation: 69

How do I find the file creation date to the bat?

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?

Upvotes: 1

Views: 3938

Answers (2)

Paul
Paul

Reputation: 2710

@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
)

Upvotes: 1

foxidrive
foxidrive

Reputation: 41234

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

Upvotes: 0

Related Questions