Microsoft KB Archive/77856

= IF EXIST Finds Hidden and System Files =

Article ID: 77856

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft MS-DOS 5.0 Standard Edition
 * Microsoft MS-DOS 5.0a
 * 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

-



This article was previously published under Q77856



SUMMARY
The IF EXIST command finds system and hidden files. You may encounter a situation in which IF EXIST finds a file and then the specified action on that file fails. It is possible that the IF EXISTS command is finding a file with hidden or system attributes and the specified action fails on a hidden file.



MORE INFORMATION
To duplicate this problem, create a file called TEST.TXT and give the file system or hidden attributes using the ATTRIB command. Next, execute the following command:

if exist test.txt del test.txt

Upon execution, the above command will return

FILE NOT FOUND

Access Denied

The IF EXIST command finds the file even though it has a hidden attribute, but the DEL command does not recognize hidden or system files. The solution is to remove the system and/or hidden attributes. The IF EXIST command will then function correctly.

Additional query words: 6.22 5.00 5.00a 6.00 6.20

Keywords: KB77856

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.