Share via


IVsLaunchPad4.ExecCommandWithElevation Method

Executes the given command with elevation.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop.11.0 (in Microsoft.VisualStudio.Shell.Interop.11.0.dll)

Syntax

'Declaration
Function ExecCommandWithElevation ( _
    pszApplicationName As String, _
    pszCommandLine As String, _
    pszWorkingDir As String _
) As UInteger
uint ExecCommandWithElevation(
    string pszApplicationName,
    string pszCommandLine,
    string pszWorkingDir
)
unsigned int ExecCommandWithElevation(
    [InAttribute] String^ pszApplicationName, 
    [InAttribute] String^ pszCommandLine, 
    [InAttribute] String^ pszWorkingDir
)
abstract ExecCommandWithElevation : 
        pszApplicationName:string * 
        pszCommandLine:string * 
        pszWorkingDir:string -> uint32
function ExecCommandWithElevation(
    pszApplicationName : String, 
    pszCommandLine : String, 
    pszWorkingDir : String
) : uint

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

Return Value

Type: System.UInt32
Exit code value returned by the process (this value cannot be null).

Remarks

If the user is not currently logged in with administrator privileges, the user is prompted with the system elevation prompt. In contrast to the ExecCommand and ExecCommandEx methods, this method lacks the parameters for piping output from the process and controlling the process's lifetime, because these things cannot be done to an elevated process (unless Visual Studio is also running elevated).

In contrast to ExecCommandWithElevationIfRequired, this method always forces elevation (if user is not already elevated); this method also returns the application's exit code.

.NET Framework Security

See Also

Reference

IVsLaunchPad4 Interface

Microsoft.VisualStudio.Shell.Interop Namespace