CALL
Type: Internal (3.3 and later)
Syntax:
CALL [d:][path]batchfilename [options ]
Purpose: Calls another batch file and then returns to the current batch file to continue processing.
Discussion
Used within a batch file to specify the name of another batch file (a file with the .BAT filename extension). The original batch file calls into action the CALLed batch file. When the CALLed batch file ends, control is transferred back to the original batch file.
This command function (transfer of control back to a calling batch file) was not available prior to DOS Version 3. For more information on CALL and other batch commands, see Chapter 5, Using Batch Files.
Example
To run the files STARTER.BAT, TESTER.BAT, and FINISH.BAT in sequence, enter the following three lines in your batch file:
call starter
call tester
call finish
CHCP
Type: Internal (3.3 and later)
Syntax:
CHCP
CHCP (codepage)
Purpose: Displays or changes the code page that DOS will use. Changes the code page used by DOS for device-related system operations such as displaying or printing special language characters. (The code page is a table that defines the character set for a country.)
Discussion
To use this command, the code page number must have been previously set (refer to Appendix B for more information).
After this command sets a new code page, DOS will access the COUNTRY command in the CONFIG.SYS file (when the computer is started) to set up special foreign language characters for display or printing. Programs run after using this command to change the code page will use the new code page.
The NLSFUNC command must be used prior to using this command. Also, device drivers must be prepared in advance (refer to the MODE command).
If you select a code page that has not been prepared for your system, DOS will display an error message similar to the following:
Code page xxx not prepared for system
Active code page: xxx
Prepared system code pages: xxx xxx
The Xs will be replaced by the appropriate number. If you change code pages and a device has not been prepared for use with that code page, the code page will still be changed. However, DOS will display an error message similar to the following:
Code page xxx not prepared for device xxx.
The Xs will be replaced by the appropriate number.
Examples
If you enter CHCP without entering a number, the program will display a message similar to the following:
Active code page 437
Prepared code pages 437 863
To change the code page setting from 437 to 863, enter
chcp 863
CHDIR (CD)
Type: Internal (2.0 and later)
Syntax:
CHDIR (CD) [d:]path
CHDIR (CD)[..]
Purpose: Displays working (current) directory and/or changes to a different directory.
Discussion
Used to change from one directory to another you specify. The command can be used without the drive designator (d:) if you were changing to a different directory on the current drive. The path designator can indicate a subdirectory within another directory or subdirectory, but it must not exceed 63 characters in length. The command followed by two periods (CD..) can be used to change to the parent directory.
Enter CHDIR or CD without a drive and path designation to get a display of the current directory.
For more information on using CHDIR and other fixed-disk commands, refer to Chapter 3, Using Fixed Disks.
Examples
To demonstrate how the CHDIR command accesses the DOS directory structure, assume that two directories, WORDS and FILES have been created on a disk. These two directories are to be found within the root directory. Assume also that an additional directory, LETTERS is to be found within the WORDS directory.
To change to the directory LETTERS (that is within the directory WORDS) on the root directory of drive C, enter
cd\words\letters
The command indicates the path sequentially down through the directory path: the first backslash indicates the root directory, down through the directory WORDS, down to the target directory LETTERS.
If you are already working in the WORDS directory, you can change back to the root directory simply by entering
cd\
To change to a directory path other than through the root directory, do not enter the leading backslash. For example, if you are working in the WORDS directory, you can change to the LETTERS directory without going through the root directory by entering
cd letters
A shortcut method to change to the directory immediately above the current directory allows you to enter the CHDIR command followed by two periods. For example, to change from the LETTERS directory to its parent directory, WORDS, enter
cd..
Enter it again to change to the next higher directory (in this case, the root directory).
CHKDSK
Type: External (1.0 and later)
Syntax:
CHKDSK [d:][path][filename] [/F][/V]
Purpose: Checks a disk and provides a file and memory status report.
Discussion
Checks for errors on a disk. Displays error messages (if problems are found) and issues a status report.
If you specify the /F option, the program will correct non-contiguous errors when it finds them. These errors can be accidentally created due to the fact that DOS does not always store files in one continuous block on the disk. If space is limited on the disk (especially if you have previously erased and replaced files), DOS may store the file in two or more pieces in whatever spaces are available on the disk. If the links between the clusters (blocks of data) are lost, CHKDSK will discover the error and report it. By using the /F option, you tell CHKDSK to find any of these parts of files or programs that have become separated from the rest of the file, to create a new file for each, and to write the lost segment to these files. These new files will all start with the letters FILE and will end with four numbers (starting with 0000) plus a .CHK extension. The first file created will be labeled FILE0000.CHK.
When you use the /F option, CHKDSK also looks for and corrects other types of disk errors (refer to Appendix A for more information about CHKDSK errors). They include:
Allocation
The size of the space reserved for a file block is incorrect. This can result in the DOS error message
Allocation error in file
If you run CHKDSK using the /F option, it will alter the size allocation number.
Attribute
There are a number of possible errors having to do with DOS`s internal record of a file`s attributes. For example, a size of linking attribute associated with one or more files does not match the actual file information. This can result in the error message
Entry has a bad attribute
If you run CHKDSK using the /F option, the program will try to correct the error.
First Cluster Number Invalid
DOS`s internal directory of file information on the disk contains a pointer to file storage information that does not match the actual files stored on the disk. This can result in the error message
First cluster number is invalid, entry truncated
If you run CHKDSK using the /F option, the pointer information is corrected (truncated to a zero length file).
The CHKDSK command was also discussed in Chapter 1, Introduction.
Options
/F - Corrects errors when it finds them. If CHKDSK finds lost clusters (parts of files or programs that have become separated from the rest of the file) it will write the lost segment to new files and provide the filename FILEnnnn (nnnn will be a number starting with 0000).
/V - Displays progress messages while CHKDSK is in operation.
filename - If you enter a filename, CHKDSK also reports how many files are stored in non-contiguous blocks (see explanation of non-contiguous blocks above).
Examples
If you enter
chkdsk a:
CHKDSK will analyze the disk in drive A and report a status message. It will look something like this:
362496 bytes total disk space
53248 bytes in 2 hidden files
301056 bytes in 8 user files
8192 bytes available on disk
524288 bytes total memory
198976 bytes free
The first four lines of this display refer to the disk you specified: they indicate the total disk space (the storage capacity of the disk), the number of hidden (system) files stored on the disk, the number of user files stored on the disk, and the amount of storage space still remaining to be used. If you had created directories on the disk, they would be reported in a fifth line. The last two lines do not refer to the disk you specified; they indicate the amount of memory (RAM) in your system and how much of it remains available for use.
If (for example) three lost clusters are found, the program will also display
3 lost clusters found in 3 chains.
Convert lost chains to files (Y/N)?
After this error message is displayed, you should run CHKDSK again, this time using the /F option. Enter the command as
chkdsk a: /f
Three new files would be created on the root directory of the disk with the following filenames:
FILE0000.CHK
FILE0001.CHK
FILE0002.CHK
Each of these files will contain a lost cluster. You can use your word processor to look at these files to determine which file the lost segment came from. If the lost segment came from a text file you may be able to re-merge it with the main file. However, upon inspection, you may find that the original text file is intact. This may indicate that the lost segment resulted from file management tasks carried out by your word processor (or other type of program). In this case, you can simply delete the newly created segment file.
If the lost segment came from a program file, you probably will not be able to re-merge it. If possible, replace the file by re-copying from the original source. If you cannot replace the file, check the program file that is stored on disk carefully by running all of its features. It may still be operational.