Batch Files Tips - Batch File Hints and Snippets Updated October 27 2025
Lots of Date Batch File examples are on this page:
https://www.robvanderwoude.com/datetime.php
More pages are available too:
https://www.robvanderwoude.com/bht.php

Copy to Clipboard rem Set the date in the format "2020-10-24" to the variable %Today% FOR %%A IN (%Date%) DO ( FOR /F "tokens=1-3 delims=/-" %%B in ("%%~A") DO ( SET Today=%%D-%%B-%%C ) ) echo Date to use for filenames: '%Today%'



Get day of week (0=Sunday, 1=Monday, 6=Saturday, set to var %dow%
Copy to Clipboard setlocal for /f %%d in ('"powershell (Get-Date).DayOfWeek.Value__"') do set dow=%%d




©2024 - Some portions of this website are Copyrighted.
Your IP: 216.73.216.135     Referring URL:
Browser: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Terms and Conditions, Privacy Policy, and Security Policy