Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need held with a simple bat file

Status
Not open for further replies.

pduncan

IS-IT--Management
Jun 20, 2003
203
US
I am using the following:

for /f "tokens=2,3,4 delims=/ " %%a in ('date /t') do set FILENAME=%%a%%b
echo %filename%

to create a file that needs to be in MMDD format.

My problem is that the day needs to reflect yesterday's date. For example if I run this I get 0618 it needs to say 0617. Any suggestions?

Thanks,
PDuncan

PDUNCAN - MEMPHIS, TN

When I die, I want to die like my grandfather-- who died peacefully in
his sleep. Not screaming like all the passengers in his car.
 
well your going to have to parse the date using the "set" command then rebuild it.
once you have defined your MMDD format to FILENAME

set month=%filename:0,2%
set day=%filename:2,2%

set day=%day%-1
set filename=%month%%day%

the problem comes when the day is the first day of the month
and now you have a day of 0...cant help you with that one...
but maybe this sparked an idea of your own.
hope this helps.

cdc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top