2

on UWP, I want to run a Exe file with parameter. Here is an example.

process.exe filename.txt

this Command line application process the text file and output a result file as Text.

My Question is

How to pass the parameter. I success to run Exe file on UWP, but the input full path for filename maybe wrong and failed.

in ViewModels,

await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("spectrum");

in Package.appxmanifest

  <Extensions>
    <desktop:Extension Category="windows.fullTrustProcess" Executable="Assets\identify\process.exe" >
      <desktop:FullTrustProcess>
        <desktop:ParameterGroup GroupId="spectrum" Parameters="Assets\Identify\filename.txt"/>
      </desktop:FullTrustProcess>
    </desktop:Extension>
  </Extensions>
...
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</DeviceCapability>

Now, I put a file on Assets\identify folder. it is same folder with exe file. but Exefile can not find the input file.

How should I write in "desktop:ParameterGroup...." ??

Is there anyway to pass Argument in programmatically ? Honestly, I do not want to write argement in Package.appxmanifest.

Update 1: I tried this too. but can not find the filename.

        <desktop:ParameterGroup GroupId="spectrum" Parameters=".\Assets\Identify\filename.txt"/>

Update 2

my external application show this error :

enter image description here

This mean, My external applicaiton received strange string as input argument. "*/InvokerPRAID : App Appx/identify/souma.spe"

What is /InvokerPRAID : App ??

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51
Kazuhiko Nakayama
  • 801
  • 1
  • 8
  • 24
  • 1
    Duplicate of https://stackoverflow.com/questions/46008948/how-to-launch-a-full-trust-desktop-bridge-app-from-uwp-with-arbitrary-paramete/46009106 – Stefan Wick MSFT Dec 12 '17 at 05:07
  • Possible duplicate of [How to launch a full-trust (desktop bridge) app from UWP with arbitrary parameters](https://stackoverflow.com/questions/46008948/how-to-launch-a-full-trust-desktop-bridge-app-from-uwp-with-arbitrary-paramete) – Stefan Wick MSFT Oct 27 '18 at 05:31

1 Answers1

1

If you want to pass the parameter to the arguments of the Win32 application, the value is in the third argument.

UWP Package Manifest:

<desktop:ParameterGroup GroupId="spectrum" Parameters=".\Assets\Identify\filename.txt"/>

Win 32 Application

static void Main(string[] args)
{
   //args[0] = "/InvokerPRAID :"
   //args[1] = "App"
   var fullTrustProcessParam = args[2]; //".\Assets\Identify\filename.txt"
}
Damian.H
  • 151
  • 2
  • 5
  • how do I pass parms into my UWP app through the public MainWindow initialization method? IE: my XAML UWP app is launched using either a custom web protocol `myProtocol://Launcher?user=userId&eventId=eventId;` or via another app calling `Process.Start("c:/ProgramFiles/MyCompany/MyApp.exe")` – Reahreic Feb 19 '21 at 19:54