- 1 year ago
How to prevent the console window from opening when fire FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync
Comment
1 / 1
To prevent the console window from opening when using the FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync
method in a UWP app, you can set the CreateNoWindow
property of the ProcessStartInfo
object to true
before launching the process. Here is an example:
csharpusing Windows.ApplicationModel;
...
string exePath = Package.Current.InstalledLocation.Path + @"\MyApp.exe";
ProcessStartInfo startInfo = new ProcessStartInfo(exePath);
startInfo.CreateNoWindow = true;
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(startInfo);
In this example, the CreateNoWindow
property is set to true
to prevent the console window from opening when launching the process. The FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync
method is then called with the ProcessStartInfo
object as the parameter.
By setting the CreateNoWindow
property to true
, you can prevent the console window from opening when launching a process using the FullTrustProcessLauncher
in a UWP app.