Provides methods for launching child processes.
More...
|
static Process | Start (this ProcessStartInfo startInfo) |
| Starts a new Process and runs it in parallel with this one. Handles and wraps Win32Exceptions. More...
|
|
static Process | Start (string fileName, params string[] arguments) |
| Starts a new Process and runs it in parallel with this one. Handles and wraps Win32Exceptions. More...
|
|
static int | Run (this ProcessStartInfo startInfo) |
| Starts a new Process and waits for it to complete. Handles and wraps Win32Exceptions. More...
|
|
static ProcessStartInfo | Assembly (string name, params string[] arguments) |
| Creates a ProcessStartInfo for launching an assembly located in Locations.InstallBase. More...
|
|
static ProcessStartInfo | AsAdmin (this ProcessStartInfo startInfo) |
| Modifies a ProcessStartInfo to request elevation to Administrator on Windows using UAC. More...
|
|
static void | SanitizeEnvironmentVariables () |
| Workaround for environment variable problems, such variable names that differ only in case when running on Windows. More...
|
|
Provides methods for launching child processes.
◆ AsAdmin()
static ProcessStartInfo NanoByte.Common.ProcessUtils.AsAdmin |
( |
this ProcessStartInfo |
startInfo | ) |
|
|
inlinestatic |
Modifies a ProcessStartInfo to request elevation to Administrator on Windows using UAC.
- Exceptions
-
PlatformNotSupportedException | The current operating system does not support UAC or it is disabled.. |
◆ Assembly()
static ProcessStartInfo NanoByte.Common.ProcessUtils.Assembly |
( |
string |
name, |
|
|
params string[] |
arguments |
|
) |
| |
|
inlinestatic |
Creates a ProcessStartInfo for launching an assembly located in Locations.InstallBase.
- Parameters
-
name | The name of the assembly to launch (without the file extension). |
arguments | The command-line arguments to pass to the assembly. |
◆ Run()
static int NanoByte.Common.ProcessUtils.Run |
( |
this ProcessStartInfo |
startInfo | ) |
|
|
inlinestatic |
Starts a new Process and waits for it to complete. Handles and wraps Win32Exceptions.
- Returns
- The exit code of the child process.
- Exceptions
-
IOException | There was a problem launching the executable. |
FileNotFoundException | The executable file could not be found. |
NotAdminException | The target process requires elevation but the UAC prompt could not be displayed because ProcessStartInfo.UseShellExecute is false . |
OperationCanceledException | The user was asked for intervention by the OS (e.g. a UAC prompt) and the user cancelled. |
◆ SanitizeEnvironmentVariables()
static void NanoByte.Common.ProcessUtils.SanitizeEnvironmentVariables |
( |
| ) |
|
|
inlinestatic |
Workaround for environment variable problems, such variable names that differ only in case when running on Windows.
Call this before any access to ProcessStartInfo.EnvironmentVariables to avoid ArgumentExceptions.
◆ Start() [1/2]
static Process NanoByte.Common.ProcessUtils.Start |
( |
string |
fileName, |
|
|
params string[] |
arguments |
|
) |
| |
|
inlinestatic |
Starts a new Process and runs it in parallel with this one. Handles and wraps Win32Exceptions.
- Parameters
-
fileName | The path of the file to open or executable to launch. |
arguments | The command-line arguments to pass to the executable. |
- Returns
- The newly launched process;
null
if an existing process was reused.
- Exceptions
-
IOException | There was a problem launching the executable. |
FileNotFoundException | The executable file could not be found. |
NotAdminException | The target process requires elevation but the UAC prompt could not be displayed because ProcessStartInfo.UseShellExecute is false . |
OperationCanceledException | The user was asked for intervention by the OS (e.g. a UAC prompt) and the user cancelled. |
◆ Start() [2/2]
static Process NanoByte.Common.ProcessUtils.Start |
( |
this ProcessStartInfo |
startInfo | ) |
|
|
inlinestatic |
Starts a new Process and runs it in parallel with this one. Handles and wraps Win32Exceptions.
- Returns
- The newly launched process.
- Exceptions
-
IOException | There was a problem launching the executable. |
FileNotFoundException | The executable file could not be found. |
NotAdminException | The target process requires elevation but the UAC prompt could not be displayed because ProcessStartInfo.UseShellExecute is false . |
OperationCanceledException | The user was asked for intervention by the OS (e.g. a UAC prompt) and the user cancelled. |
The documentation for this class was generated from the following file: