Testing If a Drive or Directory Exists from a Batch File (65994)
The information in this article applies to:
- Microsoft MS-DOS operating system 3.1
- Microsoft MS-DOS operating system 3.2
- Microsoft MS-DOS operating system 3.21
- Microsoft MS-DOS operating system 3.3
- Microsoft MS-DOS operating system 3.3a
- Microsoft MS-DOS operating system 4.0
- Microsoft MS-DOS operating system 4.01
- Microsoft MS-DOS operating system 5.0
- Microsoft MS-DOS operating system 5.0a
- Microsoft MS-DOS operating system 6.0
- Microsoft MS-DOS operating system 6.2
- Microsoft MS-DOS operating system 6.21
- Microsoft MS-DOS operating system 6.22
- Microsoft Windows for Workgroups 3.11
This article was previously published under Q65994 SUMMARY
You can use the IF EXIST statement to check for the presence of a
directory. For example, to test for C:\WIN and then change to C:\WIN if it
exists, use the following batch file:
C:
IF NOT EXIST C:\WIN\NUL GOTO NOWINDIR
CD \WIN
:NOWINDIR
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | KB65994 kbAudDeveloper |
---|
|