Pipe (|) After IF EXIST Fails

This article was previously published under Q74464
This article has been archived. It is offered "as is" and will no longer be updated.
There is a known problem with the pipe (|) command that causes the pipe tofail when used after an IF EXIST statement. For example, the command
IF EXIST c:\dos\readme.txt TYPE c:\dos\readme.txt | MORE
normally displays the contents of C:\DOS\README.TXT one screen at atime. When this command is issued under MS-DOS 5.0, 6.0, or 6.2 noinformation is displayed and you are returned to the prompt, even thoughthe file exists.

In addition, this command results in File Allocation Table (FAT)corruption on the drive that the TEMP environment variable is pointingto or on the current drive if no TEMP variable has been set. RunningCHKDSK after this command shows there are "<x> lost clusters in 1chain," where <x> is dependent upon the size of the file beingprocessed by the pipe. (The number of lost clusters and chains mightbe larger if there was additional FAT corruption prior to using thepipe.) The FAT corruption caused by this command does not result indata loss, and you can use CHKDSK with the /F switch to correct thecorruption.

Please refer to the "Microsoft MS-DOS User's Guide and Reference" formore information on the use of the CHKDSK command.

Microsoft has confirmed this to be a problem in MS-DOS versions 5.00,5.00a, 6.00, 6.20, 6.21, and 6.22. We are researching this problem and willpost new information here as it becomes available.
6.22 5.00 5.00a 6.00 6.20 batch

Article ID: 74464 - Last Review: 10/26/2013 11:45:00 - Revision: 3.0

Microsoft MS-DOS 5.0 Standard Edition, Microsoft MS-DOS 6.0 Standard Edition, Microsoft MS-DOS 6.2 Standard Edition, Microsoft MS-DOS 6.21 Standard Edition, Microsoft MS-DOS 6.22 Standard Edition

  • kbnosurvey kbarchive KB74464