Adding Day Of week to file name in batch file
I want to run a daily incremental backup and append the day of the week to the file name so I end up with:
backup_mon.bak
backup_tue.bak
etc.
Not really bothered about what exactly is appended - 0 - 6 is fine.
How do I go about this?
Since you're using this for a backup, you are presumably running the script with admin privileges, in which case you can use wmic.
for /F "tokens=2 skip=2 delims=," %%D in ('WMIC Path Win32_LocalTime Get DayOfWeek /Format:csv') do @echo %%D
Will give you the day of week as a number (Monday=1).
Take a look at Advanced date and time math in batch files. You find there a subroutine which converts a date to the Julian calendar and another one which will tell you the weekday.