How to run an exe file with arguments in an UWP application?

Michael Friedrich 21 Reputation points
2021-04-26T14:40:33.307+00:00

Sorry if Im missing something, Im pretty new to development in general.

I would like to run an exe file on my UWP program with parameters set on a .txt file, but I dont know how.

Ive tried this:

<Extensions>
<desktop:Extension Category="windows.fullTrustProcess" Executable="Assets\app.exe">
<desktop:FullTrustProcess>
<desktop:ParameterGroup GroupId="exec" Parameters="Assets\param.txt"/>
</desktop:FullTrustProcess>
</desktop:Extension>
</Extensions>

But with no luck, can someone guide me in the right direction?
Also, is it possible to launch a .bat file instead of an .exe file? Since the .bat file executes the .exe file with the right arguments.

Thanks.

Developer technologies | Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,866 Reputation points
    2021-04-27T06:30:00.773+00:00

    Hello, Welcome to Micorosoft Q&A,

    How to run an exe file with arguments in an UWP application?

    For your scenario, the quick way to accomplish the scenario is to have the UWP write the command string to the local app data/settings, which is shared between the two processes. So the full-trust process can then pick up the command string after its been launched from there.

    For more detail you could refer stefan's blog UWP with Desktop Extension – Part 2 and it contains code sample that you could refer.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.