home *** CD-ROM | disk | FTP | other *** search
- Echo off
- CLS
- Echo This is the Third TMES DEMO
- Echo TMES Copyright 1993 by Tee Roper
- Echo All Rights Reserved
- Echo.
- Echo It will illustrate the use of Variables, Logic, Math, and Clock use.
- Echo First we "TMES" SET four variables: A0 A1 A2 A3 to four values.
- ECHO TMES A0 10
- tmes A0 10
- ECHO TMES A1 20
- tmes A1 20
- ECHO TMES A2 30
- tmes A2 30
- ECHO TMES A3 40
- tmes A3 40
- tmes hour /thour
- Echo.
- Echo TMES XX /tmin
- Echo We set XX equal to the minutes past the hour, like 45, 22, etc.
- TMES XX /tmin
- TMES hour /gt 12 ans
- if '%ans%'=='1' goto pm
- TMES suffix AM
- goto cont
- :pm
- TMES hour /sub 12
- TMES suffix PM
- :
- :cont
- Echo The time NOW is %HOUR%:%XX% %suffix% as determined by your system.
- Echo So, the minutes, XX, in this DEMO was found to be %XX%, now!
- Echo.
- pause
- Echo.
- Echo TMES SA %XX%
- TMES SA %XX%
- Echo We are "saving" that variable %XX% for use later as variable SA.
- Echo XX=%XX% and also SA=%SA% because we saved it. (XX will change later.)
- Echo.
- Echo We calculate the MODULUS of XX MOD 4 (the remainder after dividing)
- ECHO TMES XX /mod 4 (the remainder is stored into XX)
- tmes xx /mod 4
- Echo Now, We check to see which "A"variable is the same as the "/Tmin" variable
- Echo TMES A%XX% /eq 20 ANS
- TMES A%XX% /eq 20 ANS
- Echo Last, we report the findings...up to the minute (when we checked!)
- if '%ANS%' == '0' echo ANSWER (False) The A%XX% is not 20, ANS=%ANS%
- if '%ANS%' == '1' echo ANSWER (True) A%XX% is 20, ANS=%ANS%
- :: the XX was changed to 0 or 1 in the MOD statement.
- :: that's why we saved XX before we calculated the MOD above.
- Echo.
- Echo I will erase the 9 variables unless you CONTROL-C to stop me now.
- pause
- Echo TMES /del A0 A1 A2 A3 ANS XX SA HOUR SUFFIX
- TMES /del A0 A1 A2 A3 ANS XX SA HOUR SUFFIX
- Echo This is a difficult batch file to understand. Don't worry if you
- Echo don't understand it at first. Keep it for future use. Enjoy TMES!
- ::
-