Microsoft KB Archive/37346

= RUN &quot;PROG.EXE&quot; Fails in QB.EXE Editor; Use RUN &quot;PROG&quot; Instead =

Article ID: 37346

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft QuickBasic 4.0, when used with:  Microsoft BASIC Compiler 6.0

 Microsoft BASIC Compiler 6.0b  Microsoft QuickBASIC 4.0b, when used with:  Microsoft BASIC Compiler 6.0

 Microsoft BASIC Compiler 6.0b</li></ul> </li> Microsoft QuickBasic 4.5 for MS-DOS, when used with:  Microsoft BASIC Compiler 6.0</li></ul>

 Microsoft BASIC Compiler 6.0b</li></ul> </li> Microsoft QuickBasic Professional Development System 7.0, when used with:  Microsoft MS-DOS 6.22 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q37346

<div class="summary_section">

SUMMARY
If you want to RUN a QuickBasic program, such as PROG.BAS, from within the environment, you must type RUN &quot;PROG&quot; instead of RUN &quot;PROG.EXE&quot;. RUN &quot;PROG&quot; successfully loads and executes the source file PROG.BAS. RUN &quot;PROG.EXE&quot; will fail in the editor (as designed) but will succeed in an .EXE running outside the editor.

You cannot use the RUN statement to invoke a non-QuickBasic application from within the QB.EXE editor environment; however, you can use the RUN statement from a compiled .EXE program running outside the editor.

To invoke a non-QuickBasic application from within the QB.EXE editor, you can SHELL to it or exit QuickBasic before invoking it.

QB.EXE Version 4.50 fails to give you an immediate error message if you RUN an executable file from inside the editing environment. QB.EXE Version 4.50 attempts to load and execute the .EXE or .COM program as a text module, which will fail. QBX.EXE which comes with Microsoft Basic PDS Version 7.00 behaves the same as QB.EXE 4.50. It loads the .EXE or .COM file and attempts to execute it as Basic source code. This is not considered to be a problem with those products but is a result of incorrect use of the RUN statement in the environment.

<div class="moreinformation_section">

MORE INFORMATION
To illustrate the problem, execute (SHIFT+F5) the following program in the QB.EXE editor: RUN &quot;WORD.COM&quot; 'Any executable .EXE or .COM file will demonstrate QB.EXE Version 4.50 attempts to load in WORD.COM as a document; this produces garbage characters in the edit window. (WORD.COM is taken from Microsoft Word.) The environment windows are redrawn, and an &quot;Expected: Statement&quot; error box appears. At this point, you can exit QuickBasic, and no harm is done.

If this program is compiled with BC.EXE, the resultant .EXE file successfully transfers control to WORD.COM.

The results of testing with QuickBasic versions earlier than 4.50 are as follows:
 * 1) QuickBasic Version 4.00b does not produce an error message, but opens a new module (&quot;Untitled&quot;). If compiled with BC.EXE Version 4.00b, the .EXE file runs as expected.
 * 2) QuickBasic Version 4.00 produces a &quot;Bad File Mode&quot; on the RUN &quot;WORD.COM&quot; statement when run inside the environment, but executes properly when compiled to an .EXE file.
 * 3) In QuickBasic Versions 2.00, 2.01, and 3.00, the QB.EXE editor successfully executes RUN &quot;WORD.COM&quot; and removes QuickBasic from memory.

Additional query words: QuickBas BasicCom

Keywords: KB37346

-

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

© Microsoft Corporation. All rights reserved.