With Invalid COMSPEC, Invoking MS-DOS Shell Hangs Machine

Last reviewed: July 17, 1997
Article ID: Q60748
2.20 3.00 3.11 3.14 4.00 4.01 4.05 4.10 | 2.20 3.00 3.11 3.12 3.50
MS-DOS                                  | OS/2
kbtool

The information in this article applies to:

  • Microsoft CodeView for MS-DOS, versions 2.2, 3.0, 3.11, 3.14, 4.0, 4.01, 4.05, and 4.1
  • Microsoft CodeView for OS/2, versions 2.2, 3.0, 3.11, 3.12, and 3.5

SUMMARY

If you set your COMSPEC environment variable to point to an invalid command interpreter, and then shell out of any MS-DOS application, your machine will hang. This problem occurs because the file that COMSPEC points to is assumed to be a valid command interpreter and cannot be checked for validity.

MORE INFORMATION

This is expected behavior. Because .COM files have no standard file header structure, they cannot be checked for validity. Therefore, MS-DOS must assume that whatever the COMSPEC environment variable points to must be a valid command interpreter, and can do no further error checking.

This behavior can easily be demonstrated in any program that allows you to access an MS-DOS shell, including CodeView, Programmer's WorkBench (PWB), the Microsoft Editor (M), and the Quick environments. Type the following line at the MS-DOS prompt:

   SET COMPSPEC=a:\junk.c ; Invalid command.com file

Then enter an MS-DOS application and shell out. Your machine will hang, and you may receive strange error messages.

If you are running under OS/2, you will be warned about an invalid command interpreter when you attempt to shell to the operating system. Under OS/2, the system expects an .EXE file to be the command interpreter, and .EXE files have a standard, recognizable structure that can be checked.


Additional reference words: kbinf 2.20 3.00 3.50 4.00 4.10
KBCategory: kbtool
KBSubcategory: CvwIss
Keywords : kb16bitonly


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.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.