Created
June 6, 2024 07:11
-
-
Save bdonvr/2190e985e8812cc5ca1f6089877a7738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableExtensions EnableDelayedExpansion | |
:: Use WMIC to retrieve date and time in a consistent format | |
for /f "tokens=2 delims==," %%x in ('wmic os get localdatetime /value') do set datetime=%%x | |
:: Extract the date in YYYYMMDD format | |
set "year=!datetime:~0,4!" | |
set "month=!datetime:~4,2!" | |
set "day=!datetime:~6,2!" | |
:: Rename files containing 'FDD' or 'MP' | |
for %%i in (*FDD*.*) do ren "%%i" "8851 FDD !year!!month!!day!.xlsx" | |
for %%i in (*MP*.*) do ren "%%i" "8851 MP !year!!month!!day!.xlsx" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment