COMSPEC; SHELL "Illegal Function Call", Can't Find COMMAND.COM (21901)






This article was previously published under Q21901

SUMMARY

Customers who have floppy disk drive systems frequently find that the SHELL command fails in the QuickBasic editor or in a program running on the system because QuickBasic cannot find COMMAND.COM.

Note that the SHELL command will work reliably only under DOS Version 3.00 or later.

MORE INFORMATION

Failure to locate COMMAND.COM during a SHELL can generate one of the following errors:

  1. The error message "File not found"
  2. The error message "Could not load COMMAND.COM"
  3. The error message "Illegal Function Call"
  4. A refusal to SHELL
A program needs to find COMMAND.COM before it can execute a SHELL statement. The SHELL command in the File menu in the editor in QuickBasic Version 2.00, 2.01, 3.00, 4.00, 4.00b, or 4.50 also needs to find COMMAND.COM before executing.

QuickBasic looks first for COMMAND.COM in the directory specified by the system COMSPEC environment variable and then in the current directory.

The COMSPEC environment variable can be set by the MS-DOS SET command in your AUTOEXEC.BAT file or in the MS-DOS command line, as follows:
   SET COMSPEC=drive:\directory
				
To tell MS-DOS where to find COMMAND.COM, you can also specify the following command in your MS-DOS Version 3.20 CONFIG.SYS file (which is executed at boot time):
   SHELL=A:\COMMAND.COM /E:1000 /P
				
In the above command, /E:size sets the size (in bytes) for MS-DOS environment space, and /P tells the command processor that it is the first program in the system so that it can process the MS-DOS EXIT command. This SHELL= statement may not work under MS-DOS Version 3.30, but works properly under MS-DOS Version 3.20. Under MS-DOS Version 3.30, you need to use SET COMSPEC.

This article applies to QuickBasic Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50 for the IBM PC and compatibles, Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and Microsoft Basic PDS Version 7.00 for MS-DOS.

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB21901