If you want to start the UWP application from the command line, you need to set an alias for the UWP application instead of waking up by calling the exe file.
Command-Line Activation of Universal Windows Apps
According to your description, you want to start the UWP application after booting, this can be done through StartupTask
.
StartupTask
package.appxmanifest
<Package xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" ...>
...
<Applications>
<Application ...>
...
<Extensions>
<uap5:Extension Category="windows.startupTask">
<uap5:StartupTask
TaskId="MyStartupId"
Enabled="false"
DisplayName="Test startup" />
</uap5:Extension>
</Extensions>
</Application>
</Applications>
The following code creates a StartupTask:
StartupTask startupTask = await StartupTask.GetAsync("MyStartupId"); // Pass the task ID you specified in the appxmanifest file
switch (startupTask.State)
{
case StartupTaskState.Disabled:
// Task is disabled but can be enabled.
StartupTaskState newState = await startupTask.RequestEnableAsync(); // ensure that you are on a UI thread when you call RequestEnableAsync()
Debug.WriteLine("Request to enable startup, result = {0}", newState);
break;
case StartupTaskState.DisabledByUser:
// Task is disabled and user must enable it manually.
MessageDialog dialog = new MessageDialog(
"You have disabled this app's ability to run " +
"as soon as you sign in, but if you change your mind, " +
"you can enable this in the Startup tab in Task Manager.",
"TestStartup");
await dialog.ShowAsync();
break;
case StartupTaskState.DisabledByPolicy:
Debug.WriteLine("Startup disabled by group policy, or not supported on this device");
break;
case StartupTaskState.Enabled:
Debug.WriteLine("Startup is enabled.");
break;
}
App.xaml.cs
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
...
if (e.Kind == ActivationKind.StartupTask)
{
// DO SOMTHING
}
...
}
By adding StartupTask
, after the user allows, the system will automatically start the UWP application after login.