IVsLaunchPad3.ExecCommandWithElevationIfRequired 方法

定义

执行给定的命令,并提供提升的机会。

public:
 int ExecCommandWithElevationIfRequired(System::String ^ pszApplicationName, System::String ^ pszCommandLine, System::String ^ pszWorkingDir);
public:
 int ExecCommandWithElevationIfRequired(Platform::String ^ pszApplicationName, Platform::String ^ pszCommandLine, Platform::String ^ pszWorkingDir);
int ExecCommandWithElevationIfRequired(std::wstring const & pszApplicationName, std::wstring const & pszCommandLine, std::wstring const & pszWorkingDir);
public int ExecCommandWithElevationIfRequired (string pszApplicationName, string pszCommandLine, string pszWorkingDir);
abstract member ExecCommandWithElevationIfRequired : string * string * string -> int
Public Function ExecCommandWithElevationIfRequired (pszApplicationName As String, pszCommandLine As String, pszWorkingDir As String) As Integer

参数

pszApplicationName
String

中环境传递到的应用程序名称 CreateProcess

pszCommandLine
String

中环境传递给的命令行字符串 CreateProcess

pszWorkingDir
String

中环境传递到的工作目录 CreateProcess 。 可以为 null 引用。

返回

Int32

如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。

注解

如果该命令需要提升权限,系统会提示用户提供系统提升提示。 如果此命令不需要提升 (或已在 Visual Studio 提升的状态下运行,或者操作系统版本高于 Windows Vista) ,则会在不提示的情况下启动命令。 与之前的执行命令方法 (ExecCommandExecCommandEx) 不同,此方法缺少进程的管道输出的参数并控制进程的生存期,因为这些操作不能在提升的进程中执行 (除非 Visual Studio 还在运行提升的) 。

适用于