Dec 122017
Test for dates, conditions in Batch files.
File TESTIF11.ZIP from The Programmer’s Corner in
Category Batch Files
Test for dates, conditions in Batch files.
File Name File Size Zip Size Zip Type
TESTIF.DOC 5878 2336 deflated
TESTIF.EXE 12800 6628 deflated

Download File TESTIF11.ZIP Here

Contents of the TESTIF.DOC file

Computer Tyme TESTIF * Copyright 1988 by Marc Perkel
All Rights Reserved * Version 1.0 * Release Date: 05-29-88

Computer Tyme * 216 South Glenstone * Springfield Mo. 65802
Computer Tyme * 1430 West 8th Street * West Plains Mo. 65775

(417) 866-1222 voice * (417) 866-1665 data * Fido Node 14/631
(417) 256-6664 voice * (417) 257-2111 data * Fido Node 14/633

Registration $25 Required! Commercial and Site Licenses Available.
If you like this program, you ought to send me the Twenty Five Bucks.

This program tests the system and returns dos error codes that can be used
to control the execution of .BAT files. Error codes range from 0 to 255.
Within this program are commands for reading system parameters and processing
them mathematically into useful error codes.

TESTIF VideoMode

VideoMode is a Testif command that returns the current video mode. If the
current mode is MONO then VideoMode returns a 7.

Testif has the capibility to test results to see if a command equals a

TESTIF VideoMode = 7

Returns error code 1 if true and 0 if not true. A 1 is always returned to
indicate TRUE and 0 is returned to indicate FALSE. Operators include
=, [], [, ], [=, ]=. Note the square brackets replace the normal greater
than and less than symbols. That is becuase MS-DOS filters these characters
and therefore can't be used.

TESTIF Year = 88 and Month = May

Testif supports all logical operators such as AND, OR, XOR, NOT. Multiple
conditions can be used. Year returns the year part of the system date. Month
returns the month part. May is a constant equal to 5. The error code result
will be 1 for true or 0 for false.

TESTIF MemSize / 10

MemSize returns the total memory size in K. Since this number is usually
larger than 255, (the maximum error code), we devide by 10. On a 640k
machine, the return code is 64. Notice that division is supported. Testif
supports the mathematical operators +, -, *, /, MOD, SHL, SHR, AND, OR, XOR.
All numbers are processed as signed 32 bit integers. It is up to you to
keep the result between 0 and 255 for meaningful results.

TESTIF 5*(9+3)

Interpretation is from left to right. Parentheses can be used to alter this
order. The above example returns 60.

TESTIF FreeSpace(0) ] 4000000

This checks freespace on the current drive (0). Other drives can also be
checked. The result is 1 if more than 4,000,000 bytes are free.


This returns the filesize of TESTIF.EXE in K.

To test your formulas, start the line with an @ sign. Testif will print the
return code on the screen.

TESTIF @DosVersion
Return Code: 3

TESTIF Commands:

SUN Constant = 0
MON Constant = 1
TUE Constant = 2
WED Constant = 3
THU Constant = 4
FRI Constant = 5
SAT Constant = 6

JAN Constant = 1
FEB Constant = 2
MAR Constant = 3
APR Constant = 4
MAY Constant = 5
JUN Constant = 6
JUL Constant = 7
AUG Constant = 8
SEP Constant = 9
OCT Constant = 10
NOV Constant = 11
DEC Constant = 12

MONO Constant = 7
CO80 Constant = 3
BW80 Constant = 2
CO40 Constant = 1
BW40 Constant = 0

VideoMode Returns Current Video Mode
VideoPage Returns Current Video Page
ScreenWidth Returns Current Screen Width
Year Returns System Year (88=1988)
Month Returns System Month
Day Returns System Day
DayOfWeek Returns System Day of week (0=SUN)
Hour Returns System Hour
Minute Returns System Minute
Second Returns System Second
WriteVerify Returns if Write Verify is on
DosVersion Returns Dos Version Number
MinorDosVersion Returns Minor Dos Version Number
CurrentDrive Returns Current Drive Number (A: = 0)
Drives Returns Number of Drives
Floppies Returns Number of Floppy Drives
SerialPorts Returns Number of Serial Ports
ParellelPorts Returns Number of Parralel Ports
CapsLock Tells if Caps Lock is on (1=True)
NumLock Tells if Num Lock is on (0=False)
ScrollLock Tells if Scroll Lock is on
MemSize Returns Total Memory Size in K
Random Returns a Random Number from 0 to 255.
SectorsPerCluster(n) Returns Number of Sectors per Cluster (0=Current Drive)
BytesPerSector(n) Returns Number of Bytes per Sector (1=A:)
FreeClusters(n) Returns Number of Free Clusters (2=B:)
TotalClusters(n) Returns Total Number of Clusters (3=C:)
FreeSpace(n) Returns Free Space in Bytes (4=D:)
TotalSpace(n) Returns Total Space in Bytes
Exist Tells if File Exists
FileSize Returns File Sise in Bytes
FileAttr Returns File Attribute
FileDate Returns Date and Time as 32 bit Number
Mem(A:B) Returns Byte at A:B
MemW(A:B) Returns Word at A:B
Port(A) Returns Byte at Part A

= True if A = B
[] True if A <> B
[ True if A < B
] True if A > B
[= True if A <= B
]= True if A >= B
+ Returns A + B
- Returns A - B
* Returns A * B
/ Returns A / B
MOD Returns A mod B
AND Returns A and B
OR Returns A or B
XOR Returns A xor B
SHL Returns A shl B (Shift Left)
SHR Returns A shr B (Shift Right)
NOT Returns not A

I am going to expand this program. I welcome suggestions. If you want me to
include a test that this program doesnt have, let me know how the test is
performed. (DOS call, memory location, port, ect.) I welcome your comments
and you $25 registration.

Marc Perkel * Computer Tyme

 December 12, 2017  Add comments

Leave a Reply