Re: DOS SET Command to reference "Yesterday's Date"


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]

Posted by Valerie on October 10, 2007 at 04:18:19:

In Reply to: DOS SET Command to reference "Yesterday's Date" posted by Darryl Workman on October 09, 2007 at 14:08:17:

Use the /A option in the Set dwday line of your file as below and note the -1 to decrement the day by 1.

SETLOCAL
SET dwMONTH=%DATE:~4,2%
SET /A dwDAY=%DATE:~7,2%-1
SET dwYEAR=%DATE:~10,4%
SET dwDate=%dwYEAR%-%dwMONTH%-%dwDAY%
ECHO %dwYEAR%-%dwMONTH%-%dwDAY%
ECHO %dwDate%

See this site for other arithmetic operators. http://www.robvanderwoude.com/ntset.html

Good luck




Follow Ups:



Post a Followup (use TAB key to move between boxes - NOT ENTER or RETURN)

Name:
E-Mail:

Subject:

Type your comments in the box below and SUBMIT:


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]