troubleshooting Question

Windows Batch script Date format

Avatar of Samooramad
Samooramad asked on
Windows Batch
9 Comments2 Solutions32464 ViewsLast Modified:
Hi experts,
I have a Windows script that is setting the name of a file with extension of date format as yyyymmdd.

It is working but I am wondering how I could modify it to make the date that of yesterday's instead of todays. Here is part of the script


set today=%date:~-4%%date:~4,2%%date:~7,2%
set spt_file_name=SPT.%today%

The command above works to make the file name for example SPT.20071030
I would like it to be SPT.20071029

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros