Introduction
Who This Book Is For
How This Book Is Structured
Special Notes
Hardware And Software
Writing The Book
Conventions
Last Notes
Chapter 1: Writing OS/2 Batch Files
It's ASCII
Starting The Enhanced Editor
Basic Editing
Intermediate Editing
Advanced Editing
Keeping It Simple
Summary
Chapter 2: Starting A Batch File
Creating A Subdirectory And Modifying Your Path
Using A Command Line
Using An Icon
More On Icons
Icon Editor
Installing An Icon
Have
A Disk File Ready
Create
A New Icon
Paste
An Existing Icon
Drop-And-Drag
An Icon
Summary
Chapter 3: Batch File Introduction
What Are Batch Files Good For?
Keystrokes Reduction
New Command Construction
Consistency
Safety
Three Different Types Of Batch Files
Summary
Chapter 4: Batch File Construction
What Is A Batch File?
Batch File Formatting
Capitalization
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 5: Documentation Or "Why In The World Did I Do That?"
Written Documentation
Even More Documentation
Self-Documentation
Special Information At The Top
Bypassing The Comments
Summary
Chapter 6: Let's Keep It Quiet
Command Echoing
Summary
Chapter 7: Talking To The User
Displaying Messages
Telling The User What Is Going
On
Keeping The User Informed
Giving The User Instructions
Making Your Messages Attractive
Plan For OS/2 Windows
Smaller Screen
Background Operation
Blank Lines
What You Can And Can't Echo
Pipes
Percent Sign
On/Off
Summary
Chapter 8: Using High-Ordered ASCII Characters
Entering High-Ordered ASCII Characters
Entering High-Ordered ASCII Characters When Your Editor
Won't Let You
More On The Enhanced Editor
Summary
Chapter 9: Hold That Batch File!
Pausing The Batch File
Aborting The Batch File
Summary
Chapter 10: Applications And Problems
Problem 1
Problem 2
Problem 3
Answers
Chapter 11: Replaceable Parameters
Sending Replaceable Parameters To A Batch File
Passing Replaceable Parameter When A Batch File Is Run From
The Desktop
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 12: Using More Than Ten Replaceable Parameters
The SHIFT Command
Batch File Tables
What SHIFT Can Do
Using The SHIFT Command
Summary
Chapter 13: 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
Watching For Wildcards In
Replaceable Parameters
DOS FOR Command Quirks
Summary
Chapter 14: The Environment
The Prompt
The Path
COMSPEC
Environmental Variables
Some Notes On Names
Not All Environmental Variables Are Permanent
Putting Variables Into The Environment
Using The Environment In Batch Files
What You Can Do With Environmental Variables
Restoring The Environment In A Batch File
Using The Environment When Shelling Out Of A Program
Using The Environment In A Batch File
Summary
Chapter 15: Errorlevel
Summary
Chapter 16: Command Line Punctuation
Piping And Redirection
The Available Piping Symbols
Devices To Pipe To/From
How OS/2 Handles A Pipe
Piping And Redirection Must
Use The Command Processor
Filters To Use In Pipes
Problems With Redirection And
Piping
Command Line Operators
+
:
.
@
%
%%
%Variable%
=
==
Summary
Chapter 17: Logic Testing
Are Two Values The Same?
What Is The Errorlevel?
Does A File Exist?
Does A Subdirectory Exist?
Earlier Batch File Revisited
A.CMD
RONNYMD.CMD
TOA.CMD
Preview Of Chapter 19
Summary
Chapter 18: Applications And Problems
Problem 4
Problem 5
Problem 6
Answers
Chapter 19: Advanced Logic Testing
NOT
Inter-Batch Communications
Dealing With Capitalization
GOTO %1
Environmental Variables
Run A Program
Capitalization Conclusion
Multiple IF-Tests
A Shorter Way To Show The Errorlevel
Summary
Chapter 20: Advanced getting information from users
Working With Errorlevel
Getting Any Character With
GET-ONE.CMD
Getting Just A Letter With
GETA2Z.CMD
Getting Just A Number With
GET_0-9.CMD
Getting Just A Yes Or No With
YESORNO.CMD
Getting More Information With The Environment
Getting One Word With GET.CMD
Converting To Uppercase With
CAPITAL.CMD
You Can Change These
Summary
Chapter 21: Advanced Screen Design
Text files
Writing A Program
Ansi
Summary
Chapter 22: Advanced Screen Design 2: Ansi
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
An Example
Summary
Chapter 23: Batch File Subroutines
What Is A Subroutine, And How Do I Write One?
As A Separate Batch File
Running A Subroutine In Another File
An Example
Inside The Calling Batch File
Storing Subroutine Commands Within A Batch File
A Final Word On Batch File Subroutines
Running REXX Programs
Summary
Chapter 24: When Batch Files Don't Work
Possible Error Messages
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 25: Applications And Problems
Problem 7
Problem 8
Problem 9
Answers
Chapter 26: REXX Programming
Background
Introduction
Variables And Branching
Logic Testing And Looping
Subroutines
Summary
Chapter 27: Batch File Utilities
A Brief Word On Licensing
Getting Information From The User
Getting Words From The User
Converting To Uppercase
Getting Any Character From The
User
Getting A Letter
Getting A Number
Yes Or No
Finding ASCII Characters
Summary
Chapter 28: An Automated Batch File Help System
Help Files
Customized Help
Context-Sensitive Help
Summary
Chapter 29: 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 30: Keeping Two Computers In Synchronization
Getting The Computers Prepared
Step 1: Get A Subdirectory
List
Step 2: Get Everything
Synchronized
Step 3: Make A Backup Of Both
Computers
Using The System
The Operation Of PREPARE.CMD
The Operation Of GETFILES.CMD
The Operation Of A:DOTHIS.CMD
Dealing With Disks
Backup Warning!
Adding Compression
What To Do If They Get Out-Of-Synchronization
Dealing With More Than Two Computers
A Few Words On Ethics And Privacy
Summary
Chapter 31: Simulating DOSKEY Using Batch Files
Command Line Macros
Command Line Recorder
Summary
Chapter 32: Smaller Batch File Applications
Screen Saver
Changing Subdirectories
Finding Files
Batch File Floppy-disk Catalog
Adding To And Deleting From Your Path
Summary
Appendix A: Solutions To Problems
Problem 1
Problem 2
Problem 3
Problem 4
Problem 5
Problem 6
Problem 7
Problem 8
Problem 9
Conclusion
Appendix B: Batch File Documentation
0-9.CMD
2-THINGS.CMD
A.CMD (2 Versions)
ACCOUNT1.CMD
ACCOUNT2.CMD
ACCTHELP.CMD
ANSIDEMO.CMD
ANSIHIDE.CMD
ANSIKEY1.CMD
B.CMD
BATCH.CMD
BLANK.CMD
BOOT-4-D.CMD
CAPITAL.CMD
CATALOG.CMD
CHECK.CMD
CHECKERR.CMD
CHECKER1.CMD
CL.CMD
COMMANDS.CMD
COMPILE.CMD
COPYBACK.CMD
COPYTHEM.CMD
COPYTHE2.CMD
COUNT.CMD
DELOLD.CMD
DISCARD.CMD
EDITPATH.CMD
ENDLESS.CMD
ENTERHEX.CMD
FASTFIND.CMD
FORMAT.CMD
GET.CMD
GET-ONE.CMD
GET_0-9.CMD
GETA2Z.CMD
GETFILES.CMD
HELLO.CMD
HELP.CMD
HELP1.CMD
HELPBAT.CMD
HELPBAT2.CMD
HELPBAT3.CMD
HI-ASCII.CMD
I.CMD
ISITZERO.CMD
KEY-1.CMD
KEY-2.CMD
LISTFILE.CMD
LOCAL.CMD
LOTUS.CMD
MACRO.CMD
NICEPROM.CMD
NOBURN.CMD
PREPARE.CMD
PROBLEM2.CMD
RCD.CMD
READFILE.CMD
REMOVE.CMD
RETURN.CMD
RETURN2.CMD
RETURN3.CMD
REXX-1.CMD
REXX-2.CMD
REXX-3.CMD
REXX-4.CMD
REXX-5.CMD
REXX-6.CMD
REXX-7.CMD
REXX-8.CMD
REXX-9.CMD
REXX-10.CMD
REXX-11.CMD
REXX-12.CMD
RONNYMD.CMD (2 Versions)
RUNCHECK.CMD
SAMPLE.CMD
SENDANSI.CMD
SENDANS2.CMD
SHOW-A.CMD
SHOW-CAP.CMD
SHOWGETS.CMD
SHOWPIPE.CMD
SHOWREPL.CMD
SHOWSHIFT.CMD
TEMP.CMD
TEMPLATE.CMD
TESTWILD.CMD
TOA.CMD (5 Versions)
TXTSCRN.CMD
UNBLANK.CMD
UNENTER.CMD
USEOVER.CMD
WORD2QS.CMD
WP.CMD
YESDOC.CMD
YESORNO.CMD
Appendix C: Icons
Appendix D: Batch File Icons
© 2002 by Ronny Richardson, All Rights Reserved