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


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

Posted by Frank on October 22, 2007 at 20:34:20:

In Reply to: Re: DOS SET Command to reference "Yesterday's Date" posted by Valerie on October 10, 2007 at 04:18:19:

Maybe I am missing something but you are simply decrementing the day by one. There is nothing here to handle month or year transitions. Too bad one cannot get to the epoch time as with Linux.

: 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 ]