IVsLaunchPad3::ExecCommandWithElevationIfRequired Method (String^, String^, String^)
Executes the given command with the opportunity for elevation.
Assembly: Microsoft.VisualStudio.Shell.Interop.9.0 (in Microsoft.VisualStudio.Shell.Interop.9.0.dll)
int ExecCommandWithElevationIfRequired(
String^ pszApplicationName,
String^ pszCommandLine,
String^ pszWorkingDir
)
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::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
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).