Indicate command line activation successfully completed UWP

Viewed 128

I am working on a text-editor app that can be activated via command line. The argument provided is treated as path to file, i.e. pad launches the app but pad "C:\Sample.txt" launches the app and then displays the "Sample.txt" file. This works well in command prompt, but in power-shell after command is executed, the execution completes only after the app is closed. Also, the execution is recorded as failed. Is there any way I can notify the command to be completed successfully from my app itself??

Example of the difference in command line activation of Windows Terminal in both command prompt and power-shell: https://drive.google.com/file/d/15gBiCcio3feGwxappgyBm68lezK5I0t2/view?usp=sharing

1 Answers

Since you are comparing cmd.exe vs powershell.exe uwpapp starts. Remember the cmd.exe simply does not hold/wait for the process/exe it started, whereas PowerShell does for uwp at least, by design.

As a workaround, if you want the PowerShell consolehost to immediately be available for more interactive steps, then you can use jobs to simulate what you are seeing when using cmd.exe. So, from a WT PowerShell session...

Start-Job -ScriptBlock {wt}
Related