description | title | ms.date | helpviewer_keywords | ms.assetid | ||||
---|---|---|---|---|---|---|---|---|
Learn more about: How to: Invoke the Command-Line Compiler (Visual Basic) |
How to: Invoke the Command-Line Compiler |
07/20/2015 |
|
0fd9a8f6-f34e-4c35-a49d-9b9bbd8da4a9 |
You can invoke the command-line compiler by typing the name of its executable file into the command line, also known as the MS-DOS prompt. If you compile from the default Windows Command Prompt, you must type the fully qualified path to the executable file. To override this default behavior, you can either use the Developer Command Prompt for Visual Studio, or modify the PATH environment variable. Both allow you to compile from any directory by simply typing the compiler name.
[!INCLUDEnote_settings_general]
-
Open the Visual Studio Tools program folder within the Microsoft Visual Studio program group.
-
You can use the Developer Command Prompt for Visual Studio to access the compiler from any directory on your machine, if Visual Studio is installed.
-
Invoke the Developer Command Prompt for Visual Studio.
-
At the command line, type
vbc.exe
sourceFileName and then press ENTER.For example, if you stored your source code in a directory called
SourceFiles
, you would open the Command Prompt and typecd SourceFiles
to change to that directory. If the directory contained a source file namedSource.vb
, you could compile it by typingvbc.exe Source.vb
.
-
Use the Windows Search feature to find Vbc.exe on your local disk.
The exact name of the directory where the compiler is located depends on the location of the Windows directory and the version of the ".NET Framework" installed. If you have more than one version of the ".NET Framework" installed, you must determine which version to use (typically the latest version).
-
From your Start Menu, right-click My Computer, and then click Properties from the shortcut menu.
-
Click the Advanced tab, and then click Environment Variables.
-
In the System variables pane, select Path from the list and click Edit.
-
In the Edit System Variable dialog box, move the insertion point to the end of the string in the Variable Value field and type a semicolon (;) followed by the full directory name found in Step 1.
-
Click OK to confirm your edits and close the dialog boxes.
After you change the PATH environment variable, you can run the Visual Basic compiler at the Windows Command Prompt from any directory on the computer.
-
From the Start menu, click on the Accessories folder, and then open the Windows Command Prompt.
-
At the command line, type
vbc.exe
sourceFileName and then press ENTER.For example, if you stored your source code in a directory called
SourceFiles
, you would open the Command Prompt and typecd SourceFiles
to change to that directory. If the directory contained a source file namedSource.vb
, you could compile it by typingvbc.exe Source.vb
.