0

I am giving files names that includes their creation dates.

I have done it like this so far: filename%date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%.txt

It seemed to work fine when i tested it, but now i discovered that my script fails when it is run between 12:00AM and 10:00AM.

I just located the reason:

  A:\Archive>echo %date:~6,4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%
20170217 93258

For some reason when the hour is only one digit, a space occur.

Is there any way to fix this?

Its a .bat script btw :)

Lauge
  • 13
  • 2

0 Answers0