Share via


IVsLaunchPad3.ExecCommandWithElevationIfRequired Method

Definition

Executes the given command with the opportunity for elevation.

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

Parameters

pszApplicationName
String

[in] Application name that is passed to CreateProcess by the environment.

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 a null reference.

Returns

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

Remarks

If the command requires elevation, the user is prompted with the system elevation prompt. If the command does not require elevation (or if Visual Studio is already running elevated, or if the operating system version is later than Windows Vista), the command is launched without a prompt. In contrast to previous execute command methods (ExecCommand and ExecCommandEx), this method lacks the parameters for piping output from the process and controlling the process' lifetime, because these things cannot be done to an elevated process (unless Visual Studio is also running elevated).

Applies to