共用方式為


IVsLaunchPad.ExecCommand Method

Definition

Executes a command with output piped to an output pane in the IDE.

public:
 int ExecCommand(System::String ^ pszApplicationName, System::String ^ pszCommandLine, System::String ^ pszWorkingDir, System::UInt32 lpf, Microsoft::VisualStudio::Shell::Interop::IVsOutputWindowPane ^ pOutputWindowPane, System::UInt32 nTaskItemCategory, System::UInt32 nTaskItemBitmap, System::String ^ pszTaskListSubcategory, Microsoft::VisualStudio::Shell::Interop::IVsLaunchPadEvents ^ pVsLaunchPadEvents, [Runtime::InteropServices::Out] System::UInt32 % pdwProcessExitCode, cli::array <System::String ^> ^ pbstrOutput);
int ExecCommand(std::wstring const & pszApplicationName, std::wstring const & pszCommandLine, std::wstring const & pszWorkingDir, unsigned int lpf, Microsoft::VisualStudio::Shell::Interop::IVsOutputWindowPane const & pOutputWindowPane, unsigned int nTaskItemCategory, unsigned int nTaskItemBitmap, std::wstring const & pszTaskListSubcategory, Microsoft::VisualStudio::Shell::Interop::IVsLaunchPadEvents const & pVsLaunchPadEvents, [Runtime::InteropServices::Out] unsigned int & pdwProcessExitCode, std::Array <std::wstring const &> const & pbstrOutput);
public int ExecCommand (string pszApplicationName, string pszCommandLine, string pszWorkingDir, uint lpf, Microsoft.VisualStudio.Shell.Interop.IVsOutputWindowPane pOutputWindowPane, uint nTaskItemCategory, uint nTaskItemBitmap, string pszTaskListSubcategory, Microsoft.VisualStudio.Shell.Interop.IVsLaunchPadEvents pVsLaunchPadEvents, out uint pdwProcessExitCode, string[] pbstrOutput);
abstract member ExecCommand : string * string * string * uint32 * Microsoft.VisualStudio.Shell.Interop.IVsOutputWindowPane * uint32 * uint32 * string * Microsoft.VisualStudio.Shell.Interop.IVsLaunchPadEvents * uint32 * string[] -> int
Public Function ExecCommand (pszApplicationName As String, pszCommandLine As String, pszWorkingDir As String, lpf As UInteger, pOutputWindowPane As IVsOutputWindowPane, nTaskItemCategory As UInteger, nTaskItemBitmap As UInteger, pszTaskListSubcategory As String, pVsLaunchPadEvents As IVsLaunchPadEvents, ByRef pdwProcessExitCode As UInteger, pbstrOutput As String()) As Integer

Parameters

pszApplicationName
String

[in] Application name that is passed to CreateProcess by the environment. For more information, see CreateProcess.

pszCommandLine
String

[in] Command line string that is passed to CreateProcess by the environment.

pszWorkingDir
String

[in] Working directory that is passed to CreateProcess by the environment. Can be null.

lpf
UInt32

[in] Launch pad flags. Values are taken from the _LAUNCHPAD_FLAGS enumeration.

pOutputWindowPane
IVsOutputWindowPane

[in] Pointer to the IVsOutputWindowPane interface created by CreatePane(Guid, String, Int32, Int32).

nTaskItemCategory
UInt32

[in] Task item category, if lpf is set to LPF_PipeStdoutToTaskList. Values are taken from the VSTASKCATEGORY enumeration.

nTaskItemBitmap
UInt32

[in] Task item bitmap, if lpf is set to LPF_PipeStdoutToTaskList.

pszTaskListSubcategory
String

[in] Task list subcategory, if lpf is set to LPF_PipeStdoutToTaskList.

pVsLaunchPadEvents
IVsLaunchPadEvents

[in] Pointer to the IVsLaunchPadEvents interface.

pdwProcessExitCode
UInt32

[out] Value returned by process.

pbstrOutput
String[]

[out] true if all output was generated. Can be null.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsLaunchPad::ExecCommand(  
   [in] LPCOLESTR pszApplicationName,  
   [in] LPCOLESTR pszCommandLine,  
   [in] LPCOLESTR pszWorkingDir,  
   [in] LAUNCHPAD_FLAGS lpf,  
   [in] IVsOutputWindowPane *pOutputWindowPane,  
   [in] ULONG nTaskItemCategory,  
   [in] ULONG nTaskItemBitmap,  
   [in] LPCOLESTR pszTaskListSubcategory,  
   [in] IVsLaunchPadEvents *pVsLaunchPadEvents,  
   [out] DWORD *pdwProcessExitCode,  
   [out] BSTR *pbstrOutput  
);  

If ExecBatchScript is called with lpf set to LPF_PipeStdoutToOutputWindow | LPF_PipeStdoutToTaskList, ExecBatchScript internally calls ParseOutputStringForTaskItem. This means that any output generated by pszApplicationName must meet the format requirements of ParseOutputStringForTaskItem.

Applies to