Batfiles: The DOS batch file programming handbook & tutorial © Laurence Soucy 1997-2000




Batfiles Home

Contents

Foreword

Introduction
What are batfiles?
What can they do?
Why learn batfiles?

Before you start

Basic batfiles

Glossary

Selftest


If this page doesn't look right,
you need:

Netscape




T
U
T
O
R
I
A
L


Batfiles
The DOS batch file programming handbook & tutorial
Contents

 1. The boot process
 2. Internal and external commands
 3. Command hierarchy
 4. Syntax and help.com
 5. The DOS editor - your friend
 6. Break and verify
 7. Doskey.com
 8. Echo, redirection and pipes
The call command
Using doskey to create a batch file

 9. Prompt and path
10. Doskey macros
11. Variables and the Set command
12. Temp and copycmd variables
13. The environment
Comspec variable
Shell statement

14. The ansi.sys device driver
Set screen colors and text attributes
Remap the keyboard

15. Smartdrv.exe
16. Partition your hard disk
17. Using a RAM drive
18. Input and data directories
19. Optimize config.sys
20. Optimize autoexec.bat
21. Optimize BIOS
22. Simple batfiles
BEEP.BAT Beep once.
BLANK.BAT Blank screen until key is pressed.
BO.BAT Turn break on and show previous status.
VO.BAT Turn verify on and show previous status.
ORGPATH.BAT Return to original path started with.
ORGPRMPT.BAT Return to original prompt started with.
STDPRMPT.BAT Set standard DOS prompt; no ansi.sys.
COLPRMPT.BAT Set color prompt; ansi.sys.
MACROS.BAT Load doskey macros.
DKM.BAT Show doskey macros.
More simple batfiles
CMDHIS.BAT Show command history.
LEFT.BAT Show bytes left on drive.
EC.BAT Edit config.sys.
EA.BAT Edit autoexec.bat.
Fixed batfiles
BAT.BAT Change to bat directory.
DOS.BAT Change to dos directory.
CTEMP.BAT Change to c:\temp directory.
MAPKEYS.BAT Maps keys to desired values.
RESKEYS.BAT Restore keys to original values.
SAVHIS.BAT Save command history.
EHIS.BAT Edit command history.
BATBAK.BAT Make bat directory back up.
TXTPRMPT.BAT Set txt prompt; no ansi.sys.
Replaceable parameters
Goto and labels
Rem vs. the colon

E.BAT Run edit.com.
H.BAT Run help.com.
The IF statement
If a file exists
If multiple files exist
If a file does not exist
If a drive exists
If a directory exists
If strings are equal
If strings are not equal
Comparing variables
If errorlevel
If not errorlevel
Smart batfiles
Documentation guidelines
Built-in help function
TD.BAT Change to %temp% directory.
XDIR.BAT Extended dir; find file with partial name.
HOWMANY.BAT How many files in current and sub-directories.
DRIVE.BAT Report total bytes and bytes free on drive.

BEGWORK.BAT Make record of when you begin work.
ENDWORK.BAT Make record of when you end work.
TT.BAT Open timetrak.dat; file where work record is.
REMIND.BAT Be reminded of important things.
RENE.BAT Rename a file and open it in edit.
COPYE.BAT Copy a file and open the new file in edit.
MOVEE.BAT Move a file and open it in edit.

CDD.BAT Change Drive and Directory.
CPD.BAT Change to parallel directory.
CPPD.BAT Change to parent parallel directory.
MDCH.BAT Make new directory and change (to it).
MPD.BAT Make new parallel directory.
MPDCH.BAT Make new parallel directory and change.
MPPD.BAT Make new parent parallel directory.
MPPDCH.BAT Make new parent parallel directory & change.
LOCATE.BAT Locate file on current or specified drive.
CHKDRV.BAT Check if drive exists.
FFILE.BAT Find file on current drive with partial file name.
ADDPATH.BAT Add a directory to path.
ENVSIZE.BAT Report environment size required.
VARIBEEP.BAT Variable beep in number and interval.
ONCEADAY.BAT Run a program once a day.
Shift
SHOWFILE.BAT Show contents of one or more files.
COPFILES.BAT Copy one or several files.
1TOMANY.BAT Copy 1 file to many files.
Batfiles with secondary or ancilliary batfiles
CHKDRVS.BAT Check which drives exist.
CHKVOL.BAT Check volume label on all drives.
DRIVES.BAT Bytes total and free on all or specific drives.
SEARCH.BAT Search all drives for a file.


Top of page Batfiles Home Foreword

This page last updated 9 March 2000
E-mail the author.  Main site: http://purl.oclc.org/net/Batfiles/
© Laurence Soucy 1997, 2001. All rights reserved.