Udostępnij za pośrednictwem


IVsLaunchPad4.ExecCommandWithElevation(String, String, String) Method

Definition

Executes the given command with elevation.

public:
 System::UInt32 ExecCommandWithElevation(System::String ^ pszApplicationName, System::String ^ pszCommandLine, System::String ^ pszWorkingDir);
public:
 unsigned int ExecCommandWithElevation(Platform::String ^ pszApplicationName, Platform::String ^ pszCommandLine, Platform::String ^ pszWorkingDir);
unsigned int ExecCommandWithElevation(std::wstring const & pszApplicationName, std::wstring const & pszCommandLine, std::wstring const & pszWorkingDir);
public uint ExecCommandWithElevation (string pszApplicationName, string pszCommandLine, string pszWorkingDir);
abstract member ExecCommandWithElevation : string * string * string -> uint32
Public Function ExecCommandWithElevation (pszApplicationName As String, pszCommandLine As String, pszWorkingDir As String) As UInteger

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

Returns

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.

Applies to