FG
💻 Software

Adding Day Of week to file name in batch file

Fresh5 days ago
Mar 15, 202616339 views
Confidence Score0%
0%

Problem

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?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Adding Day Of week to file name in batch file

Low Risk

Since you're using this for a backup, you are presumably running the script with admin privileges, in which case you can use wmic. Will give you the day of week as a number (Monday=1).

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment