Share via


Visual Basic Concepts

Working with Command Line Switches

Command line switches provide a way to control how Visual Basic executes. Using command line switches, you can start an instance of Visual Basic and run a specified project, make an executable file or dynamic-link library, or specify a string to be passed to the Command$ function.

For example, to run the project MyProj.vbp and then automatically exit, start Visual Basic with the following command line:

c:\Program Files\Microsoft Visual Studio\VB\vb6.exe /runexit MyProj.vbp

The following table summarizes the Visual Basic command line switches.

Switch Description
/cmd cmdstring Specifies a command string to be passed to the Command$ function. When used, it must be the last switch on the command line.
/d compileconst Specifies one or more conditional compilation constants to use with the /make or /makedll switch.
/make projectname Makes the specified project into an executable file.
/makedll projectname Makes the specified project into a dynamic-link library.
/mdi Starts Visual Basic using the multiple document interface (MDI) programming environment.
/out filename Outputs errors to a file when used with the /make or /makedll switch.
/run projectname Runs the specified project.
/runexit projectname Runs the specified project and then automatically exits.
/sdi Starts Visual Basic using the single document interface (SDI) programming environment.
/? Displays a list of valid command line switches.

For More Information   See "Command Line Arguments."