IVsLaunchPad3.ExecCommandWithElevationIfRequired Method
Executes the given command with the opportunity for elevation.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop.9.0 (in Microsoft.VisualStudio.Shell.Interop.9.0.dll)
Syntax
'Declaration
Function ExecCommandWithElevationIfRequired ( _
pszApplicationName As String, _
pszCommandLine As String, _
pszWorkingDir As String _
) As Integer
int ExecCommandWithElevationIfRequired(
string pszApplicationName,
string pszCommandLine,
string pszWorkingDir
)
int ExecCommandWithElevationIfRequired(
[InAttribute] String^ pszApplicationName,
[InAttribute] String^ pszCommandLine,
[InAttribute] String^ pszWorkingDir
)
abstract ExecCommandWithElevationIfRequired :
pszApplicationName:string *
pszCommandLine:string *
pszWorkingDir:string -> int
function ExecCommandWithElevationIfRequired(
pszApplicationName : String,
pszCommandLine : String,
pszWorkingDir : String
) : int
Parameters
pszApplicationName
Type: System.String[in] Application name that is passed to CreateProcess by the environment.
pszCommandLine
Type: System.String[in] Command line string that is passed to CreateProcess by the environment
pszWorkingDir
Type: System.String[in] Working directory that is passed to CreateProcess by the environment. Can be a null reference.
Return Value
Type: System.Int32
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 ), 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).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.