DTE2.ExecuteCommand Method (String, String)

Executes the specified command.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Sub ExecuteCommand ( _
    CommandName As String, _
    CommandArgs As String _
)
'Usage
Dim instance As DTE2 
Dim CommandName As String 
Dim CommandArgs As String

instance.ExecuteCommand(CommandName, _
    CommandArgs)
void ExecuteCommand(
    string CommandName,
    string CommandArgs
)
void ExecuteCommand(
    [InAttribute] String^ CommandName, 
    [InAttribute] String^ CommandArgs
)
function ExecuteCommand(
    CommandName : String, 
    CommandArgs : String
)

Parameters

  • CommandName
    Type: System.String

    Required. The name of the command to invoke.

  • CommandArgs
    Type: System.String

    Optional. A string containing the same arguments you would supply if you were invoking the command from the Command window.

    If a string is supplied, it is passed to the command line as the command's first argument and is parsed to form the various arguments for the command. This is similar to how commands are invoked in the Command window.

Implements

_DTE.ExecuteCommand(String, String)

Remarks

ExecuteCommand runs commands or macros listed in the Keyboard section of the Environment panel of the Options dialog box on the Tools menu.

You can also invoke commands or macros by running them from the command line, in the Command window, or by pressing toolbar buttons or keystrokes associated with them.

ExecuteCommand cannot execute commands that are currently disabled in the environment. The Build method, for example, will not execute while a build is currently in progress.

ExecuteCommand implicitly pauses macro recording so that the executing command does not emit macro code. This prevents double code emission when recording and invoking macros as part of what you are recording.

Examples

Sub ExecuteCommandExample()
   ' Open the New File dialog box.
   ExecuteCommand ("File.NewFile")
End Sub

.NET Framework Security

See Also

Reference

DTE2 Interface

DTE2 Members

ExecuteCommand Overload

EnvDTE80 Namespace