global menu:
Notes: This page includes batch utils (not batch files) that enhance / supplement the DOS batch language. The list does not reflect an exhaustive search. For batch files, tips, and tutorials see OTHER BATCH RESOURCES. Most of the utils below were developed exclusively for DOS and may not operate as expected under Win9x and/or NT. A very big thanks to Howard Schwartz who suggested and commented on many of the programs on this page.
PAGE 1:
PAGE 2:
An incomplete list of Batch resources on the Web (some of the following sites also have good meta-lists of additional batch resources):
ERR2ENV- Set current errorlevel to an environment parameter.
unrated [added 07-07-99]
"Dos IF statements need a lot enhancing to test for various conditions: err2env.zip is a life saver that lets you store the current error level in an environment variable and/or set it yourself." Author: Zhuhan JIANG, Australia (1994). Suggested by Howard Schwartz.
Syntax:
err2env [/qnàx#+#-#[,envpara]] or
err2env "/<>qnàx#+#-#t#[,envpara]" [fileout [filein] ]
where # represents an positive integer.
q - quiet with no non-critical messages
n - environment parameter ERR_LEVEL will not be changed
x# - exit with errorlevel specified by #
+# - exit errorlevel will be the entry errorlevel plus #
-# - exit errorlevel will be the entry errorlevel minus #
à - remove stored errorlevel addresses from ERR2ENV.EXE.
,env - set errorlevel to the environment parameter specified
by "env"
Notes: May not work properly under Win9x (recursive shell failures).
download err2env.zip (18.3K)
TESTIF- Test for system, disk, time, and file conditions in batch files.
unrated [added 07-07-99]
Tests for: VideoMode, VideoPage, ScreenWidth, Year, Month, Day , DayOfWeek, Hour, Minute , Second , WriteVerify, DosVersion, MinorDosVersion, CurrentDrive, Drives, Floppies, SerialPorts, ParellelPorts, CapsLock, NumLock, ScrollLock, MemSize, Random, SectorsPerCluster(n) BytesPerSector(n), FreeClusters(n), TotalClusters(n), FreeSpace(n), TotalSpace(n) , Exist <FileName> , FileSize <FileName>, FileAttr <FileName>, FileDate <FileName>, Mem(A:B), MemW(A:B), Port(A). Author: Marc Perkel, Computer Tyme Software. (1990); Suggested by Howard Schwartz.
download testif.zip (12K)
TEST- Test for file/directory status in batch files.
unrated [added 07-07-99]
"test evaluates the expression <expression> and, if its value is true, returns a non-zero (true) exit status; otherwise, a zero (false) exit status is returned. test returns a zero if there are no arguments."
Primitive operators testing one file:
Primitive operators comparing two files:
The above operators can be combined with logical (AND, OR) operators.
Author: Jason Mathews. (1994); Suggested by Howard Schwartz.
download test.zip (14K)
Ifnumber-Batch util makes IF-predicatiton bigger/smaller than.
unrated [added 03-18-01]
"The normal IF command cannot determine if numbers or numbered variables are big or small, while this one can It is operated by errorlevel code."
Syntax: Ifnumber.exe <number1> <predicate> <number2> Predicate can be: equival, unequival, smallerthan, biggerthan, smallerequivalthan or biggerequivalthan If the predicate is true. Ifnumber.exe returns errorlevel 1. If the predicate is false. Ifnumber.exe returns errorlevel 0. If the syntax is wrong. Ifnumber.exe returns errorlevel 255.
Author: Frank Dethlefsen (1999).
SET ENHANCERS
VARSET- Sets variables w/ file-related information; offers integer arithmetic and string operations. Win9x LFN support.
unrated [added 03-18-01]
"VARSET sets a variable to file related information. In addition some arithmetic and string functions are offered. Long file names are supported under Windows 9x (NOT Win NT/2000). Win NT compatible." Author: Horst Schaeffer, Germany. (2001).
Syntax: CALL VAR SET varname=expression [options]
Expressions:
DATE|TIME OF file
FILES|DIRS OF filespec (wildcards)
SIZE OF file(s)
LINES OF file
VOL OF drive
DRIVE|-DRIVE OF filespec
NAME OF filespec
EXT|-EXT OF filespec
LFN|SFN OF file or folder
FULL OF filespec
STRING(p,l) string
(arithmetic)
Options:
/U|L upper|lower case
/T thousands separator
/Rn right align (total size=n)
/Zn fixed length with leading zeros
ADVSET
unrated [added 07-07-99]
"Advset lets you delete, append to, prepend to an already existing variable. It also lets you convert values to all caps, all small letters, etc." Author: Kåre Fundal, Denmark (1995) Home Page ; Suggested by Howard Schwartz. Newer ftp://konrad.ruc.dk/pub/kf/advset16.zip is available but is shareware (1997).
download advset14.zip (12K)
ASET
unrated [added 07-07-99]
"ASET lets you store all kinds of information in a variable, and do arithmetic as well (a big lack in batch files)." Author: Richard Breuer, Germany (1993); Suggested by Howard Schwartz.
download aset10.zip (80K)
STRINGS
unrated [added 07-07-99]
"Strings does similar things to ASET, but takes up less memory." Author: Douglas Boling (1995); Suggested by Howard Schwartz.
download string25.zip (75K)
XECHO- Echo replacement useful for batch generation and creating logfiles.
unrated [added 07-07-99]
"The echo command often needs enhancement so you can put any ascii character in a file, or echo something to a file without starting a new line. The latter is handy for building commands in a 2nd batch file, created by a first batch file. XECHO is an enhanced echo that does these things and also lets you echo all kinds of information to the screen. XECHO also allows echoing of redirection symbols." Author: Claus-Juergen Claussen, Germany (1998) Sugg. by Howard Schwartz, others.
download xecho133.zip (84K)
SEND- ECHO enhancer.
unrated [added 09-12-99]
From the docs: "SEND is intended to remedy....defects of ECHO:
Author: Howard Rumsey and Barry Simon (1985); Sugg. by Howard Schwartz, source: Laurence Soucy's Batfiles: The DOS batch file programming handbook.
download send.zip (12K)
QECHO & LOGECHO- ECHO enhancers.
Somewhat similar to XECHO; for description/ link see: HORST batch utilities collection.
PAUSE substitutes...
1. HoldIt- PAUSE replacement time-outs after specified time.
2. MPause- PAUSE replacement uses mouse or keys to answer prompt.
3. Press- PAUSE substitute with OK button box, mouse support, time-out option.
4. BEEP- Beep PC speaker with pause option.
Locate- File finder with useful batch creation capability.
The Locate file finder can function as a user-friendly, functional "analog" of the FOR batch command or the classic SWEEP batch util. Locate can filter a set of desired files using its superior file finding options, and then execute a user command w/ arguments on the set of found files (/C). Alternatively, one can generate a batch file containing a command for each found file (/O). Macros (symbolic representations of directory name, file name, file name without extension, extension only,...see below) can be placed within the user's commands and arguments; these are translated back into their respective specific entities when Locate generates a command for each found file. The macros are:
&F fully qualified filename C:\WINDOWS\WIN.COM &D directory name, canonical C:\WINDOWS &P directory name with \ C:\WINDOWS\ &N filename WIN.COM &R filename without extension WIN &X extension only COM &S filespec without drive \WINDOWS\WIN.COM &L drive letter C: &A attributes, standard +A -S -H -R &B attribute bits A.... &W Win95 full LFN "C:\Directory Name\Long File Name" &Z Win95 LFN, filename only "Long File Name" &T terminate line && ampersand &E escape &Q quote mark &1 date &2 time &3 file size
To illustrate a most basic example, LOCATE's /O switch can be used as a wildcard "helper" for programs that don't support wildcards. Suppose you wanted to convert all *.txt files, dated today (switch /D:T), from DOS to UNIX format but your converter program (let's say DOS2UNIX) doesn't have wildcard support. Locate can easily generate a batch file that contains a DOS2UNIX conversion command for each *.txt file it finds:
LOCATE *.txt /D:T /O:"DOS2UNIX < &N > &R.unx" >>CONVERT.BAT
A couple lines from the generated CONVERT.BAT might look like this:
DOS2UNIX < one.txt > one.unx
DOS2UNIX < two.txt > two.unx
For each unique *.txt file found by LOCATE (&N), a new UNIX formatted file will be created with the original file basename (&R) and a new extension defined by the user (e.g., .unx). One advantage of using Locate (e.g., vs. FOR) is the ease with which one can filter for very specific file property combinations (filename, attributes, date, time, etc).
See description and link to Locate on File Finders and Identifiers page. Author: Charles Dye; Suggested by B. Simonsen. Also see: SNiF and FORALL.
FORALL- File finder runs commands on found files.
unrated [added 10-09-00]
Untested. FORALL appears to be functionally similar to Locate's /c option (find files and execute user commands on found files). Can function like the classic SWEEP util. FORALL.EXE runs under DOS or OS/2; some options are OS/2 specific (+-x). Author: Kai Uwe Rommel (1995), suggested by R. Scott.
Usage: FORALL [options] [pattern] ... : [command] [argument] ...
The following macros will be replaced in the command and arguments:
@F full file specification @@ single @
@D drive identifier and : @P path name and \
@S file name and extension @R relative path name and \
@N file name @E file extension
Options: -c confirm all commands before executing them
-e[n] quit if a command returns an exit code >= n
if -e is specified without n, 1 is assumed
-n do not execute commands, only show them
-u upper-case expanded file name macros
-l lower-case expanded file name macros
-v work on files NOT matching the pattern(s)
-q quiet mode, do not echo commands to screen
-f use / instead of \ as pathname separator in macro expansions
-R work recursive through subdirectories
+r -r only files with/without READ-ONLY attribute
+h -h only files with/without HIDDEN attribute
+s -s only files with/without SYSTEM attribute
+a -a only files with/without ARCHIVE attribute
+x -x only files with/without extended attributes
-d only directories
+t mmddhhmm[yy] -t mmddhhmm[yy]
only files with a timestamp later/earlier than the argument.
Valid wildcards in patterns:
? match any single character
* match zero or more occurrences of anything
[abc] match any character of a, b or c
[^abc] match any character except a, b and c
[a-z] match any character between a and z
{xx,yy,zz} match any of 'xx', 'yy', or 'zz'
If using alternatives in {}, when one word is prefix of another one,
order them with the longer word first, i.e {cs,c} instead of {c,cs}.
Example: FORALL -R -r +a D:\WORK\*.{C,ASM,DEF} : COPY @F E:
download forall72.zip (30K)
FORTUNE- Enhanced FOR.
unrated [added 07-07-99 updated 09-04-99]
FORTUNE "extends the functionality of the DOS FOR command by providing ways of splitting up the parts of the file name and manipulating the parts." Translate variables into drive, path, filename root, filename extension, and filename characters. Author: Bruce Guthrie/ Wayne Software (1999); Suggested by Howard Schwartz.
11-23-99: v911 released 11-99. See Wayne Software
Get fortn911.zip (85K) from Download Page.
INPUT- Get console input from within a batch file.
unrated [added 07-07-99]
"There are a lot of freeware programs that do what Dos CHOICE does, but better -- getting input from the keyboard. input.zip is an old one (87) I have used for years. It puts whatever you type in a variable, and also lets you set up the prompt so it takes only y/n answers, converts your input to caps, etc. " Author: William C. Parke (1987); Suggested by Howard Schwartz.
download input.zip (3K)
FDATE (2)- Multi-purpose date manipulation/ format utility for batch files.
unrated [updated 09-13-00]
Fdate is a utility for performing date formatting and date arithmetic in DOS batch files. Includes a variety of means for placing output into environment variables which can be then be manipulated in numerous ways in a batch file. Detailed and brief help documentation included; multiple help screens.
Features from the documentation:
Author: Stephen Ferg (2000), Home Page.
09-13-00: replaced v0.96a with v1.4a (08-00). Home page added.
download fdate14a.zip (123K)
Get HTML manual here: fdate14a_html_doc.zip (252K)
[ Go to Top | Front Page ]
© 1994-2001. Rich Green