Writing DR DOS Batch Files
Table Of Contents

Introduction
     Who This Book Is For
     How This Book Is Structured
     Special Notes
     Hardware And Software
     Writing The Book
     Conventions
     Last Notes

Chapter 1: Batch Files Are Just DR DOS Commands
     What Is A Batch File Good For?
          Keystrokes Reduction
          New Command Construction
          Consistency
          Safety
     Summary

Chapter 2: Creating Your Own Batch Files
     Picking A Name
     Internal DR DOS Commands
     External Commands
     How DR DOS Decides Which Command To Run
     Where To Put Batch Files
     Creating Batch Files
          The COPY Command
          Editor
          Using A Different Editor On Batch Files
     Summary

Chapter 3: Batch File Construction
     What Is A Batch File?
     Batch File Formatting
          Capitalizatio n
          Spacing
          Indenting Sections
          Message Length
          Line-Length Limit
     Let's Write A Batch File
     The Problem
     The Solution
     A Second Problem
     The Solution
     Summary

Chapter 4: Documentation Or "Why In The World Did I Do That?"
     Written Documentation
     Even More Documentation
          Self- Documentation
          Special Information At The Top
          Tricky Documentation
          Using Labels As Remarks
          Bypassing The Comments
     Conclusion
     Summary

Chapter 5: Let's Keep It Quiet
     Command Echoing
     Summary

Chapter 6: Talking To The User
     Displaying Messages
          Telling The User What Is Going On
          Keeping The User Informed
          Giving The User Instructions
     A DR DOS 5 Bug
     Making your messages attractive
     Blank Lines
     What You Can And Can't Echo
          DR DOS Pipes
          Percent Sign
          On/Off
     Longer And Fancier Messages
     Summary

Chapter 7: Using High-Ordered ASCII Characters
     Entering High-Ordered ASCII Characters
     Entering High-Ordered ASCII Characters When Your Editor Won't Let You
     Summary

Chapter 8: Hold That Batch File!
     Pausing The Batch File
     Aborting The Batch File
     `Halt Batch Process' Bug
     Summary

Chapter 9: Applications And Problems
     Problem 1
     Problem 2
     Problem 3
     Answers

Chapter 10: Replaceable Parameters
     Sending Replaceable Parameters To A Batch File
     Using Replaceable Parameters In Your Batch Files
     Limits On The Number Of Replaceable Parameters
     Some Uses For Replaceable Parameters
     Replaceable Parameters As Commands
     A Couple Of Examples
     Summary

Chapter 11: Using More Than Ten Replaceable Parameters
     The SHIFT Command
     Batch File Tables
     What SHIFT Can Do
     Using The SHIFT Command
     Summary

Chapter 12: Looping And Program Flow
     Pseudocode
     Naming Program Lines
     The GOTO Command
          Looping
          Transferring Control
          Quick Exit
          Handy Formatting Option
          Code Separation
          Visual Separation
     The FOR Command
          Looping With The FOR Command
          Local Variable
          Running Commands With A FOR Loop
     Summary

Chapter 13: The Environment
     The Prompt
     The Path
     Comspec
     Environmental Variables
     Increasing The Size Of The Environment
     Environmental Variables Are Transient
     Putting Variables Into The Environment
     Using The Environment In Batch Files
     What You Can Do With Environmental Variables
     Using The Environment When Shelling Out Of A Program
     Environment Problem When Shelling Out Of A Program
     Environment Benefits When Shelling Out Of A Program
     Using The Environment In A Batch File
     Summary

Chapter 14: Errorlevel
     Summary

Chapter 15: DR DOS Punctuation
     Piping
     Devices
     Filters
     Problems
     +
     :
     .
     @
     %
     %%
     %Variable%
     =
     ==
     Summary

Chapter 16: Logic Testing
     Are Two Values The Same?
     What Is The Errorlevel?
     Does A File Exist?
     Does A Subdirectory Exist?
     Earlier Batch File Revisited
          A.BAT
          RONNYMD. BAT
          TOA.BAT
     Preview Of Chapter 18
     Summary

Chapter 17: Applications And Problems
     Problem 4
     Problem 5
     Problem 6
     Answers

Chapter 18: Advanced Logic Testing
     NOT
     Inter-Batch Communications
     Dealing With Capitalization
          GOTO %1
          Environmental Variables
          The Path
          Run A Program
          Capitalization Conclusion
     Multiple If-Tests
          A Shorter Way To Show The Errorlevel
          A Very Short Way To Show The Errorlevel
     Setting The Errorlevel
     Help
     Windows
     Summary

Chapter 20: Advanced Screen Design 1
     Text files
     Writing A Program
     Using A Screen Compiler
     ANSI
     Summary

Chapter 21: Advanced Screen Design 2: ANSI.SYS
     Introduction
     Getting Started With ANSI
     Entering ANSI Commands
     Word Processors, Editors, And The Problem Of ``Escaping''
     Sending ANSI Commands By Typing A File
     Sending ANSI Commands Using The Environment
     Sending ANSI Commands Via The Prompt
     Screen Control
     Cursor Control
     Video Control
     Keyboard Control
     Summary

Chapter 22: Batch File Subroutines
     What Is A Subroutine, And How Do I Write One?
          As A Separate Batch File
          Prior To DR DOS 5 And MS DOS 3.3
          DR DOS 5, MS DOS 3.3, And Later
          An Example
     Inside The Calling Batch File
          The MS DOS-Compatible Approach 1: Skip The Subroutine Commands
          The MS DOS-Compatible Approach 2: Simulate The Subroutine Commands
     Summary

Chapter 23: When Batch Files Don't Work
     Possible Error Messages
          Syntax Error
          Bad Command Or Filename
          Command Or Filename Not Recognized
          Label ... Not Found
          Abort, Retry, Ignore, Fail?
          Abort, Ignore, Retry
          Abort, Retry, Fail
          Data Error
          Drive Not Ready
          Physical Media Error
          Sector Not Found
          Access Denied
          Access Denied For File
          Access Denied On Source Directory
          Access To File ... Denied
          Batch File Missing
          Batch file ... missing retry [Y/N]?
          Batch Files Nested Too Deep
          Not Enough Memory
          Not Enough Memory For ...
          Not Enough Memory To ...
          Not Ready Error
          Cannot Start Command, Exiting
          No Free File Handles/Cannot Start Command, Exiting
          Too Many Files Open
          Too Many Open Files
          Environment Full
          Environment Error
          Filename Too Long
          Disk Full
          Write Protect Error
          File Sharing Conflict
          On Or Off Parameter Required
          Invalid Path Or Path Not Found
          Invalid Path Specified: Check Path
          Other
     Check The Spelling
     Look Closer
     Isolate The Problem
     Split Out The Problem Section
     Diagram The Logic
     Put It Aside For A While
     Start Over
     Summary

Chapter 24: Applications And Problems
     Problem 7
     Problem 8
     Problem 9
     Answers

Chapter 25: Batcmd: New Batch File Commands
     AD (Add 1 To MATH Environmental Variable)
     BE (Beep The Speaker)
     BS (Blank The Screen)
     CC (Check Conventional Memory)
     CE (Check Environmental Memory)
     CH (Check Number of Hard Drives)
     CL (Check LIM Memory)
     CM (Check Mouse)
     CS (Check Space)
     EX (Exit)
     GE (Get To Environment)
     GF (Get From List)
     GK (Get Key)
     GL (Get Letter)
     GN (Get Number)
     GU (Get Uppercase Letter)
     PC (Position Cursor)
     RB (Reboot The Computer)
     SD (Store Day)
     SH (Store Hour)
     SL (Skip Line)
     SM (Store Minute)
     SO (Store Month)
     SS (Store Second)
     SU (Subtract 1 From MATH Environmental Variable)
     SY (Store Year)
     YN (Yes No)
     Summary

Chapter 26: Builder And Builder Lite
     Multi-Purpose Batch Languages
     Builder
          Bundling
          Power And Flexibility Of A Programming Language
          Speed Of A Compiled Language
          Full Compatibility With The MS DOS Batch Subcommands
          Ease Of Learning Of The Batch Language
     Builder Lite
     Summary

Chapter 27: Dual Boot Utility
     Creating A Boot Disk
     Back Up Your Hard Disk
     Installing Dual Boot Utility
     Troubleshooting
     Summary

Chapter 28: An Automated Batch File Help System
     Help Files
     Customized Help
     Context-Sensitive Help
     Summary

Chapter 29: Simple Batch File Menus
     Structuring Your Hard Disk
     Introduction To Menus
     Displaying The Menu
     Types Of Menus
          Non-resident Non-Nested Menus
          Resident Non-Nested Menus
          Hybrid Batch File
          Stand-Alone Batch File
          Nested Menus
     DR DOS 6 Specific Menus
     Summary

Chapter 30: Anti-Viral Batch Files
     Write-Protect Program Files
     Move COMMAND.COM Out Of The Root Directory
     Test Your Critical Files
     Summary

Chapter 31: A Document Archival System
     Periodic Backups
          Which File To Back Up?
          Types Of Backup
     Systematically Copy Critical Data Files
     Never Delete Old Files!
     Index Document Files
     Summary

Chapter 32: Simulating Doskey Using Batch Files
     Command Line Macros
     Command Line Recorder
     Running Multiple Commands
     Summary

Chapter 33: Smaller Batch File Applications
     Changing Subdirectories
     Running Inflexible Programs
     Controlling Your Printer
     Finding Files
     Printing Return Mailing Labels
     Running Commands Occasionally
     Using The Volume In A Batch File
     Batch File Floppy-disk Catalog
     Adding To And Deleting From Your Path
     Repeating Batch Files
     Controlling Software Access On A Network
     Modifying Files During Installation
     Password Protection
     Determining Codes To Use With The Password Batch File
     Summary

Chapter 34: Applications And Problems
     Problem 10
     Problem 11
     Problem 12
     Problem 13
     Answers

Chapter 35: CONFIG.SYS File Under MS DOS 3.3
     Getting Started
     Problems Booting
     Components Of DOS
     The CONFIG.SYS File
          BREAK=on/off
          BUFFERS=n
          COUNTRY=n
          DEVICE=
          FCBS=
          FILES=#
          LASTDRIVE=n
          SHELL=
          STACKS=
     Summary

Chapter 36: CONFIG.SYS File Under DR DOS 5
     The DR DOS 5 CONFIG.SYS Commands
          ? [New Unique]
          BREAK
          BUFFERS
          CHAIN [New Unique]
          COUNTRY
          DEVICE
          DRIVPARM [New]
          ECHO [NewUnique]
          FASTOPEN [New]
          FCBS
          FILES
          HIDEVICE [New]
          HIDOS [New]
          HIINSTALL [New]
          HISTORY [New]
          INSTALL [New]
          LASTDRIVE
          REM [New]
          SHELL
          Device drivers
     Improved Memory Management
     More Power!
          Approach 1: Ask About Each Line
          Approach 2: Select Which File To Run
          Other Uses
     Communication With The AUTOEXEC.BAT File
     Summary

Chapter 37: CONFIG.SYS File Under DR DOS 6
     The DR DOS 6 CONFIG.SYS Commands
          ? [Unique]
          :Label [New Unique]
          BREAK
          BUFFERS
          CHAIN [Unique]
          CLS [New Unique]
          COUNTRY
          CPOS [New Unique]
          DEVICE
          DRIVPARM
          ECHO [Unique]
          EXIT [New Unique]
          FASTOPEN
          FCBS
          FILES
          GOSUB [New Unique]
          HIBUFFERS [New]
          HIDEVICE
          HIDOS
          HIINSTALL
          HISTORY
          INSTALL
          LASTDRIVE
          REM
          RETURN [New Unique]
          SET [New]
          SHELL
          SWITCH [New Unique]
          TIMEOUT [New Unique]
     Device Drivers
     Improved Memory Management
     More Power!
     Communication With The AUTOEXEC.BAT File
     Summary

Chapter 38: The Startup And Shutdown Files
     One Minor Difference
     System Configuration
          PATH
          PROMPT
          VERIFY
          MODE
     Memory-Resident Software
     AUTOEXEC.BAT Arrangements
          All-In-One Approach
          One-Per-Task Approach
     LEAVING.BAT
     Summary

Appendix A: Solutions to problems

Appendix B: Program Documentation
     ASCII.EXE Chapter 7
     BATCMD.COM Chapter 25
     BatScreen Chapter 20
     CAPITAL.EXE Chapter 18
     Dual Boot Utility Chapter 27
     ISITZERO.EXE Chapter 30
     NEEDHELP.EXE Chapter 18

Appendix C: Batch File Documentation
     1.BAT Through 6.BAT [Chapter 29]
     A.BAT [Chapter 1]
     ACCTHELP.BAT [Chapter 9]
     ANSIDEMO.BAT Chapter 21]
     ANSIHIDE.BAT [Chapter 21]
     ANSIKEY1.BAT [Chapter 21]
     ANSIKEY2.BAT [Chapter 21]
     AUTO-1.BAT [Chapter 9]
     BLANK.BAT [Chapter 30]
     BOOT-4-D.BAT [Chapter 17]
     CATALOG.BAT [Chapter 33]
     CHECKERR.BAT [Chapter 16]
     CHECKER1.BAT [Chapter 18]
     CL.BAT [Chapter 32]
     CONFIG.SYS [Chapter 37]
     COPYBACK.BAT [Chapter 31]
     COPYTHEM.BAT [Appendix A]
     COPYTHE2.BAT [Appendix A]
     DELOLD.BAT [Chapter 31]
     DISCARD.BAT [Chapter 31]
     DOBATCMD.BAT [Chapter 25]
     DOXCOPY.BAT [Chapter 16]
     EDITPATH.BAT [Chapter 33]
     EDIT2.BAT [Chapter 33]
     ENDLESS.BAT [Chapter 12]
     FASTFIND.BAT [Chapter 33]
     FINDPASS.BAT [Chapter 33]
     FORMAT.BAT [Chapter 9]
     HELP.BAT [Chapter 28]
     HELP1.BAT [Chapter 28]
     HELPBAT.BAT [Chapter 28]
     HELPBAT2.BAT [Chapter 28]
     HELPBAT3.BAT [Chapter 28]
     HI-ASCII.BAT [Chapter 7]
     INDEX.BAT [Chapter 31]
     KILLZERO.BAT [Appendix A]
     LISTFILE.BAT [Chapter 31]
     MACRO.BAT [Chapter 32]
     MENU1.BAT [Chapter 29]
     MENU2.BAT [Chapter 29]
     MENU3.BAT [Chapter 29]
     MSDRSUB.BAT [Chapter 22]
     MULTI.BAT [Chapter 32]
     NETWORK.BAT [Chapter 33]
     NICEPROM.BAT [Chapter 21]
     OCCASION.BAT [Chapter 33]
     OCCASIN2.BAT [Chapter 33]
     PASSWORD.BAT [Chapter 33]
     PHONE.BAT [Appendix A]
     PHONE1.BAT [Appendix A]
     QCD.BAT [Appendix A]
     RCD.BAT [Chapter 33]
     READFILE.BAT [Chapter 17]
     REMOVE.BAT [Chapter 33]
     RETURN.BAT [Chapter 33]
     RETURNTO.BAT [Chapter 33]
     RETURN2.BAT [Chapter 33]
     RETURN3.BAT [Chapter 33]
     RONNYMD.BAT [Chapter 10 and 16]
     RUNCHECK.BAT [Chapter 17]
     SAYERROR.BAT [Chapter 18]
     SENDANSI.BAT [Chapter 21]
     SENDANS2.BAT [Chapter 21]
     SHOWBACK.BAT [Appendix A]
     SHOWGETS.BAT [Chapter 19]
     SHOWREPL.BAT [Chapter 10]
     SHOWSHIF.BAT [Chapter 11]
     STARTDAT.BAT [Chapter 33]
     STARTWOR.BAT [Chapter 33]
     SWITCH-M.BAT [Chapter 33]
     TEMPLATE.BAT [All Chapters]
     TESTCOMM.BAT [Chapter 30]
     TOA.BAT [Chapter 10-16]
     TOA-2.BAT [Chapter 22]
     TOA-2SUB.BAT [Chapter 22]
     TOA-3.BAT [Chapter 22]
     TOA-4.BAT [Chapter 22]
     UNBLANK.BAT [Chapter 21]
     USEOVER.BAT [Appendix A]
     VOLUME.BAT [Chapter 33]


Important Notice

The information for this book was taken from the last draft I submitted to the publisher. Since the publisher performed minor editing, the version you purchase in the store will be slightly different.


Order This Book On-Line

Order One Of These Books. Amazon.com is an on-line bookstore with a very large list of books, including all of mine that are still in print. This link will take you to Amazon.com using a special page they set up to showcase all my books. They are the easiest way I know of to order my books on-line. Of course, you can use this page to order any of the books they carry.

 

 

© 2002 by Ronny Richardson, All Rights Reserved