-2

Anybody know know how to edit a Batch for me if ok for that i saw this somewhere which create a folder 12_07_2021_132247_19 etc but i like a more reader friendly like 2012-06-19 10:23:47, here the batch:

:while

set _my_datetime=%date%_%time%
set _my_datetime=%_my_datetime: =_%
set _my_datetime=%_my_datetime::=%
set _my_datetime=%_my_datetime:/=_%
set _my_datetime=%_my_datetime:.=_%


xcopy "FOLDER NAME" ".\Backup\%_my_datetime%\" /E/H/C/I

TIMEOUT 60

goto :while
Alis
  • 11
  • 1
  • 6

1 Answers1

0

I think you dont need split the variables, becouse you can get value from date. try some thing like this:

xcopy "FOLDER NAME" ".\Backup\$(date +"%Y%m%d")\" /E/H/C/I

Can you provide us the feedback if this work for you?

Henrique Van Klaveren
  • 1,502
  • 14
  • 24
  • why not? whats ir wrong? – Henrique Van Klaveren Jul 12 '21 at 19:50
  • ok i did replace from %_my_datetime% TO $(date +"%Y%m%d") I then run the batch it did create a folder created $(date +md) but just this no YYYY MM DD etc – Alis Jul 12 '21 at 19:58
  • Thank for trying to help, it all ok as this what need %date:~6,4%~%date:~3,2%~%date:~0,2%-%time:~0,2%~%time:~3,2%~%time:~6,2% it was your idea that helped me with a search online, Thank You – Alis Jul 12 '21 at 20:50