Forum Discussion

szilardd's avatar
szilardd
Brass Contributor
Apr 26, 2023
Solved

MSIX app execution alias from cannot be selected from Task Scheduler

I have a WinForms app packaged with MSIX. One of the requirements is to be able to run the app in background mode from Windows Task Scheduler by passing a specific command line argument.   Because ...
  • szilardd's avatar
    Apr 28, 2023

    Found a workaround. Instead of configuring the task to execute the app directly like this:

    %localappdata%\AppData\Local\Microsoft\WindowsApps\MyAppName.Exe

    It can be 'proxied' through cmd.exe. And the task needs to be configured as 'Run only when user is logged on':

    cmd /C "%localappdata%\AppData\Local\Microsoft\WindowsApps\MyAppName.Exe" Arg1

    The problem with this is that it always opened the cmd window while running so it wasn't exactly running in the background. After trying several solution, the one that worked was to use nircmd (https://www.nirsoft.net/utils/nircmd.html), like this:

    nircmd execmd "%localappdata%\Microsoft\WindowsApps\MyAppName.exe" Arg1

Resources