[UWP][Desktop Converter]How can I pass arguments to my UWP app from task scheduler RRS feed

  • Question

  • We have converted one desktop application by DAC. The task is created successfully but it doesn't run. We have done following workarounds...

     Command : explorer.exe

     Arguments : shell:AppsFolder\MyUWP_jq2bw8qh45nmc!MyUWP

    It launches the application correctly by task scheduler, but we can't pass arguments to my app. How can we do that?

    • Edited by Breeze Liu Wednesday, May 24, 2017 7:06 AM add tag [UWP][Desktop Converter]
    Tuesday, May 23, 2017 2:20 PM

All replies

  • Hello Rajkumar,

    Typically you'd register your app as a protocol handler, to handle a unique protocol such as myuwp://

    Then if you want to launch your app with arguments, you'd launch a url such as myuwp://xyz/abc?arg1=something&arg2=somethingElse 

    For information on how to set this up for your application, see https://docs.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation. Please let me know if you have any questions or concerns.

    Best Regards,

    David Hollowell

    Wednesday, May 24, 2017 12:33 AM
  • Hello David,

    Thanks for your help.

    According to your suggestion we successfully invoke the app with arguments. Our app access an XML file from AppData folder (%APPDATA%). When the app is running from schedule task using protocol (myuwp://), the AppData folder is not redirecting to local app data store. It is accessing the AppData folder hence throwing FileNotFoundException . But when we run the app from start menu, it is correctly redirected to local app data store. How can our app access the local app data store when called from scheduled task using protocol?



    Wednesday, May 24, 2017 12:13 PM
  • Hi Rajkumar,

    Can you share a snippet of the code you're using to access the file?
    Additionally, can you provide the following details? Which user is setup to execute the task? What's the startup directory for the task? Can you tell what folder was resolved as the %APPDATA% value in the failing scenario?

    I look forward to hearing back from you.

    David Hollowell

    Wednesday, May 24, 2017 5:54 PM
  • Hi David,

    We have resolved the issue related to %APPDATA%. We are storing the local app data store path of the XML file in the registry under HKCU. At the time of reading the XML file, we are loading the file from the registry (HKCU) path. In this way, we succeeded to invoke the app using scheduled task ONLY when the "Run only when the user is logged on" option is selected.

    Can converted app (by DAC) run from the scheduled task when the user is not logged on i.e session 0 aka non-interactive session?



    • Proposed as answer by Breeze Liu Monday, May 29, 2017 1:22 AM
    Friday, May 26, 2017 10:38 AM
  • Hi Rajkumar,

    Can you post a new topic for the question regarding launching apps from session 0? It will help others using the forums who may have the same question.

    Best Regards,

    David Hollowell

    Friday, May 26, 2017 9:17 PM