Microsoft KB Archive/145701

= How To Close Shelled Process When Finished under Windows 95/98/Me =

Article ID: 145701

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q145701



SUMMARY
When the Visual Basic Shell command is used to execute a batch file or MS- DOS program on Windows 95, Windows 98, or Windows Me, the MS-DOS window remains open by default when the program is done executing. Under Windows 3.1, Windows for Workgroups 3.11, and Windows NT 3.51, the MS-DOS window closes by default when the program is done executing. This article shows how to force Windows 95, Windows 98, or Windows Me to close the MS-DOS window when the program is done executing.



MORE INFORMATION
To force Windows 95, Windows 98, or Windows Me to close the MS-DOS window you can use the Visual Basic Shell function with the /C option of COMMAND.COM. The /C option of COMMAND.COM will close the MS-DOS window under Windows 95, Windows 98, or Windows Me. The Visual Basic syntax for using the /C option of COMMAND.COM to execute a MS-DOS program is as follows where is the path and name of the program to execute and any command line options for it:

h = Shell("COMMAND.COM /C ")

Windows 3.1, Windows for Workgroups 3.11, and Windows NT 3.51 will still behave the same if you use the /C option of COMMAND.COM. So, you can use this technique without having to check which operating system the program is running on.

Additional query words: createprocess properties close on exit

Keywords: kbhowto KB145701

-

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

© Microsoft Corporation. All rights reserved.