Hard Disk Management: Level 2 BATCH FILES ----------- These are user created files that have the extension .BAT The file itself contains lines of DOS commands. Some think of these files as "macros". They can be created with an ASCII text editor including the built in EDLIN editor (see below), or can be created from "the console" (keyboard) via COPY CON. These are very useful for program startups. Use the TYPE command to view the contents of a batch file: C:\>TYPE 123.BAT c:\ cd\lotus 123 cd\ cls Use the PRINT command to print out the contents of a batch file: C:\>PRINT AUTOEXEC.BAT The PRINT command is like the TYPE command except it is an external DOS command and send output to the printer instead of the screen. Another approach using redirection discussed earlier would be: C:\>TYPE AUTOEXEC.BAT >PRN AUTOEXEC.BAT ------------ This user created, optional batch file is sought out by DOS when the system is BOOTed. If this file is on the BOOT disk, DOS will AUTOmatically open it and EXECute it. This is outstanding way to automate the execution of certain DOS commands like DATE, TIME, PATH, PROMPT, etc - which should be done EVERY time the system is booted. EX: date time path c:\;c:\dos;c:\batch;c:\utility subst e: c:\dbase\dbfiles prompt $p$g cls CONFIG.SYS ---------- This too is an ASCII file created and viewed like AUTOEXEC.bat. It also is optional and is sought out by DOS when the system is BOOTed. HOWEVER, the command lines that this file uses ARE NOT DOS type commands found in .BAT files. Rather, these are special CONFIGuration SYStem commands. CONFIGuration SYStem commands are needed to define certain hardware parameters. For example, if your system uses special size disk drives, extra printers, extra modems, extra input devices (joysticks, mouse), RAM disks, etc. EX: CONFIG.sys FILES = 20 BUFFERS = 15 In this example, FILES = 20 means that DOS will allow up to 20 files opened simultaneously. If this line were not present in CONFIG.SYS, DOS would only allow up to 7 files. Do we need up to 20? Certain programs (dBASE, Accounting, etc) state early in their manuals that this parameter needs to be set at 20 for the software to operate correctly. The BUFFERS = 15 defines a staging area within RAM for portions of files that are not on the screen yet. For example, in an Accounting program if you told the computer to bring up the last 10 invoices entered, it would display these 10 invoices. However, unknown to you it actually took the last 30 invoices in anticipation that you would want to see them right away also. The extra 20 that the system brought into RAM are sitting within the BUFFERS. DOS allows this and does this as a way to speed up the system. Items that are sitting in RAM can be accessed seemingly instantly versus items that must be sought from a disk. If not told, DOS automatically sets BUFFERS to 3. If BUFFERS are so useful, why not set them to their maximum of 99? The reason is that DOS is guessing which information you will need next. If it guesses wrong - for example the next invoice you wish to look at is 1500 ago, it must first check all the BUFFERS before realizing that it will have to go to the disk to retrieve the needed information. It actually slows the process down in this case. Most purchased software will note if this command is needed and what to set it to. BUFFERS = 15 is a common level to operate at. EDLIN ----- Edlin is a LINe EDitor supplied with the DOS disks. It is a very basic word processor that allows the creation and editing of Batch Files including AUTOEXEC.BAT and the CONFIG.SYS file. These files are like documents that the computer reads and interprets. Each line of these files contains a single thought for the computer. EDLIN is a device to create these documents. To enter the EDLIN environment you type the word EDLIN followed by the name of the file you wish to create or edit: C:\>EDLIN CONFIG.SYS An asterisk will appear: * You will type the letter I and press enter to go into the Insert mode: *I The computer responds with: 1:* This 1 refers to line 1 of the CONFIG.SYS you are now creating. You will now just type each line and press enter. When finished you will press the key to return to the furthest left asterisk: 1:*FILES = 20 2:*BUFFERS = 15 3: * At this asterisk you will now type E and press enter to End the process and save what you just created: *E C:\> Other EDLIN commands from the left most asterisk: *L - this would List on the screen the entire contents of the file being edited *3D - this would delete line #3 from the file *4I - this would allow inserting a new command beginning at line #4 *5 - this would allow making changes to line #5 EDLIN is adequate for creating and editing small Batch type files. We saw earlier that there is another technique for creating these files utilizing the COPY CON command. It is even more limited than EDLIN. BACKUP and RESTORE ------------------ Periodically the entire hard drive or at least the subdirectories containing data files should be BACKed-UP onto floppies or tape for safe storage in the event of a hard drive crash or accidental erasure. Should that happen, the files are then simply RESTOREd. DOS provides two commands to accomplish this - BACKUP and RESTORE commands. Unfortunately, these are slow and problematic. The world is full of third party alternatives that are far superior in speed, ease of use, data compression, and ability to incorporate into batch files so the operator only need to "kick-off" a batch file and have a supply of floppies nearby to complete. EX: Using DOS commands: C:\>BACKUP C:\lotus\*.wks A: /S /M "A" is the DESTINATION drive C:\lotus is the SOURCE directory *.wks specifies any files with an extension .wks (worksheet files) /S specifies any Subdirectories beneath \LOTUS directory (that contain *.wks files) /M only the files that have been Modified since Last BACKUP (using the same disk set as last used during the BACKUP) NOTE: Have a supply of disks for the "A" drive ready. These floppies do not have to be formatted. If more than 1 is required, be sure to number in sequence. This process will erase whatever used to be on the disk. Now, if the files need to be restored to the hard drive due to failure or erasure: Start out with "disk #1" in the "A" drive. A:\>RESTORE A: C:\lotus\*.wks /S /M "A" is now the SOURCE /M only files Modified or Deleted since they were backed up These commands were designed for emergency situations. It is better than nothing. Many wish to use them as a way to transfer a large group of files from one machine to another. This will only work if the version of DOS on each machine is identical. Another problem is that you end up with a very large number of disks. There is no data compression (which most competing products provide) which results in up to 50% fewer backup disks. A final hazard: If you end up with 20 disks, and disk number 10 is lost or destroyed, you may never be able to access disks 11-20 or 1-9. The 20 disk set is like one continuous floppy disk. By destroying 1 disk, it is like you destroyed the giant continuous floppy. This is not true of competing products like FASTBACK, PCTOOLS or NORTON UTILITIES. XCOPY ----- Beginning with DOS 3.2, the XCOPY command is a useful hybrid of the COPY command and the BACKUP/RESTORE mess. It addresses the issue that COPY cannot copy more files than a disk can hold. But, XCOPY cannot copy a single file that is larger than a single disk like the BACKUP command can. C:\>XCOPY C:\*.* a: /S /M /D:mm-dd-yy The options: /S - includes all subdirectories hung from the current one (in the case shown we are in the root directory) /M - includes only files that have been modified since the last XCOPY was performed /D:mm-dd-yy - include only files with a date greater or equal to the one specified XCOPY is: - Faster than the COPY or BACKUP commands - Able to transfer entire directories like BACKUP can - Copy files selectively by modification status or date - Able to use the COPY command (which is DOS version independent) to copy individual files at a later date - unlike BACKUP - Unable to copy single files that are larger than a single disk (BACKUP is able to do this - remember the 1 continuous disk concept) - Target disks must be formatted HARD DISK ORGANIZATION PRINCIPALS --------------------------------- 1. Put only directories in the Root directory except; Command.com, Config.sys, Autoexec.bat 2. Use many batch files. Put them in a \BATCH subdirectory 3. Keep the PATH command short in autoexec.bat PATH = c:\DOS;c:\BATCH;c:\UTILITY 4. Keep the directories sorted (use third party software tools) 5. Defragment files on a regular basis - use some third party software; PC-TOOLS, NORTON UTILITIES, VOPT, etc ***** END OF FILE: Press to return to Main Menu *****