KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q80224: FORMAT May Incorrectly Return ERRORLEVEL of Zero

Article: Q80224
Product(s): Microsoft Disk Operating System
Version(s): MS-DOS:5.0
Operating System(s): 
Keyword(s): 
Last Modified: 19-NOV-1999

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft MS-DOS operating system version 5.0 
-------------------------------------------------------------------------------

SUMMARY
=======

The MS-DOS FORMAT command may, under certain error conditions, return an
ERRORLEVEL = 0 (zero), indicating successful completion, when in fact the format
was unsuccessful.

Microsoft has confirmed this to be a problem in MS-DOS version 5.0. We are
researching this problem and will post new information here as it becomes
available.

MORE INFORMATION
================

When the FORMAT command is invoked with an invalid parameter in the command
line, it may terminate with the appropriate error message, yet return an
ERRORLEVEL of zero. This may produce undesired results in batch processing using
the "IF ERRORLEVEL=" batch file command.

For example, the command

  format a: /a

aborts with the error message "Invalid switch - /A", yet returns an ERRORLEVEL of
0 for batch processing.

Some other examples of FORMAT error conditions incorrectly returning an
ERRORLEVEL of zero are as follows:

- Cannot format an ASSIGNed or SUBSTed drive

- Parameters not compatible with fixed disk

- Parameter format not correct

- Parameter value not allowed

- Invalid drive specification

- Required parameter missing

- Too many parameters

- Invalid Volume ID

Additional query words: 5.00

======================================================================
Keywords          :  
Technology        : kbMSDOSSearch kbMSDOS500
Version           : MS-DOS:5.0

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.