You can execute commands in two ways. The
DTE object has an
ExecuteCommand method you can use to trigger a command based on its name.
Commands collection is also a vehicle for launching commands through its
Raise method. Instead of using the command’s name, the
Raise method uses its GUID and ID to identify the command.
Commands2 commands = (Commands2)_applicationObject.Commands;Command cmd = commands.Item["Window.CloseDocumentWindow"];object customIn;object customOut;commands.Raise(cmd.Guid, cmd.ID, customin, customout);
Some commands accept arguments. The
Shell command is one example. It is used ...