Поделиться через


How to: Run External Tools from Visual Studio

You can add items to the Tools menu that allow you to launch external tools from within Visual Studio. For example, you can add an item to the Tools menu to launch utilities such as OLE View or WinDiff.

Note

The options available in dialog boxes, and the names and locations of menu commands you see, might differ from what is described in Help depending on your active settings or edition. This Help page was written with General Development Settings in mind. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.

To learn more about

See

Providing key bindings and accelerator keys for external tools

Adding Accelerator Keys and Key Binding

Predefined arguments for external tools

Arguments for External Tools

Add an external tool to the Tools menu

You can add a command to the Tools menu to start another application, such as Notepad, from within the integrated development environment (IDE).

To add an external tool to the Tools menu

  1. On the Tools menu, choose External Tools.

  2. In the External Tools dialog box, choose Add, and enter a name for the menu option in the Title box.

    Tip

    Type an ampersand before one of the letters in the tool name to create an accelerator key for the command when it appears on the Tools menu. For example, if you use M&y External Tool, the letter 'y' will be the accelerator key.

  3. In the Command box, enter the path to the file you intend to launch, or choose Browse to navigate to the file. Files types that you can launch include .exe, .bat, .com, .cmd, and .pif.

    Note

    If the file resides on the system path, you can enter just the file name. If not, enter the full path to the file.

  4. Select Use output window and Close on exit, as appropriate, and then choose OK.

    Note

    The Use output window option is available for .bat and .com files only.

A command for the tool, using the text you entered as the Title, now appears on the Tools menu. You can start the tool by choosing the new menu command.

Note

Adding an external tool to the Tools menu does not register an application as the default tool of its type. For example, if you want to use your favorite external editor to modify HTML markup, you can set this preference from the Web Browser, Environment, Options Dialog Box. You can also easily create a Visual Studio add-in project to inform the IDE on startup that an external utility will handle tasks such as markup validation or source code control integration.

Pass variables to external tools

You can specify that certain information be passed to a command when it is launched, such as command line switches for console applications.

To pass variables to the tool

  1. In the Arguments box, enter the arguments you wish to pass to the tool, or choose the arrow button to select a predefined argument.

    Note

    For more information about argument syntax, see Arguments for External Tools.

  2. Select Prompt for arguments if you would like the option of editing the arguments at the time the command is launched.

When you next start the external tool from the Tools menu, the arguments you selected will be automatically passed to the tool. If you selected Prompt for Arguments, the Arguments dialog box will appear.

Specify a working directory

You can also specify the working directory for the tool or command. For example, if the tool reads file system data from the current directory, the tool requires that certain program components are present in the current directory at start up.

To specify a working directory for the tool

  • In the Initial directory box, enter the working directory for the tool, or choose the arrow button to select a predefined directory location.

Select Prompt for arguments if you would like to have the option of specifying additional arguments at the time the command is launched.

Display Unicode output in the Output window

If you use a tool that provides output in Unicode rather than ASCII, you can choose to display the Unicode in the Output window.

To display Unicode output in the Output window

  • Select Treat output as Unicode.

    Note

    Do not select this option for tools that provide output in ASCII.

See Also

Tasks

How to: Assign Access Keys and Keyboard Shortcuts to External Tools

Reference

Arguments for External Tools