You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Start-Process with AppX application URLs cannot be combined with -PassThru or -Wait #10996
Note: Perhaps there's no solution, in which case the error message should improved to provide a specific hint.
UWP / AppX-packaged applications (Microsoft Store applications) are launched by URL scheme (e.g., calculator: to start the Calculator app) rather than executable file name.
Combining this style of launching with -PassThru in order to obtain a process object identifying the newly launched process fails; ditto with -Wait to effect synchronous execution.
Steps to reproduce
Run the following on Windows:
{ Start-Process calculator: -PassThru } | Should -Not-Throw
{ Start-Process calculator: -Wait } | Should -Not-Throw
Expected behavior
The tests should pass.
Actual behavior
The tests fail (Calculator still launches, but no process object is returned / waiting doesn't occur, and an error is emitted):
Expected no exception to be thrown, but an exception
"This command cannot be run completely because the system cannot find all the information required."
was thrown
Environment data
PowerShell Core v7.0.0-preview.5 on Microsoft Windows 10 Pro (64-bit; Version 1903, OS Build: 18362.418)
Reacted by John Drogo, aWeinzierl, Ryan Stewart, Santiago Squarzon, jantari and Andy Gajdosik
changed the title [-]Start-Process with AppX application URLs cannot be combined with -PassThru[/-][+]Start-Process with AppX application URLs cannot be combined with -PassThru or -Wait[/+]on Nov 6, 2019
This came up in the Discord and it looks like pwsh is expected Process.Start to return the Process object that was started but .NET is not doing so. This result bubbles up the stack to this message as there is no process object to passthru or wait on.
In my example FileName was a jpeg that was associated with a UWP.
It seems like the problem exists in .NET and needs to be fixed there. I haven't dug into that layer to figure out why it's not returning the process object as it's definitely starting it. Most likely it's the changing executable name.
In some cases ShellExecuteEx might have it set to NULL and I think this is one of them. Unless there's a better API or mechanism in Windows/explorer to use it might just be a limitation of these types of apps and PowerShell should just generate a better error message on return if -PassThru or -Wait is being used.
This repo is used for servicing PR's for .NET Core 2.1 and 3.1. Please visit us at https://github.com/dotnet/runtime - corefx/Process.Win32.cs at b8b81a66738bb10ef0790023598396861d92b2c4 · dot...
I get this error with Windows PowerShell 5.1 on Windows 10 when using start-process on the new Microsoft Teams which is an AppX package although the new process does start. Don't get the error with the same code and Teams version on Windows 11
I found a sloppy work around for this issue. Not sure if I am allowed to post those here. I tested it with the XBox App. Start-Process xbox: then sleep for a few seconds Start-Sleep -Seconds 5. After the sleep get the running process and pipe that into Wait-Process Get-Process xboxPcApp | Wait-Process Script will pause until you close the XBox Window (Note: you need to have XBox App configured to close and not hide in settings).
Activity
[-]Start-Process with AppX application URLs cannot be combined with -PassThru[/-][+]Start-Process with AppX application URLs cannot be combined with -PassThru or -Wait[/+]StewartRyanSony commentedon Apr 1, 2022
+1. I'm running into this issue as well
jborean93 commentedon May 20, 2022
This came up in the Discord and it looks like pwsh is expected Process.Start to return the Process object that was started but .NET is not doing so. This result bubbles up the stack to this message as there is no process object to passthru or wait on.
You can verify this behaviour with:
In my example
FileNamewas a jpeg that was associated with a UWP.It seems like the problem exists in .NET and needs to be fixed there. I haven't dug into that layer to figure out why it's not returning the process object as it's definitely starting it. Most likely it's the changing executable name.
jborean93 commentedon May 20, 2022
Just a further note, it looks like .NET tries its best to get the process handle https://github.com/dotnet/corefx/blob/b8b81a66738bb10ef0790023598396861d92b2c4/src/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs#L90-L116.
In some cases
ShellExecuteExmight have it set toNULLand I think this is one of them. Unless there's a better API or mechanism in Windows/explorer to use it might just be a limitation of these types of apps and PowerShell should just generate a better error message on return if-PassThruor-Waitis being used.guyrleech commentedon Dec 14, 2023
I get this error with Windows PowerShell 5.1 on Windows 10 when using start-process on the new Microsoft Teams which is an AppX package although the new process does start. Don't get the error with the same code and Teams version on Windows 11
TheErstwhile commentedon Feb 10, 2024
I found a sloppy work around for this issue. Not sure if I am allowed to post those here. I tested it with the XBox App.
Start-Process xbox:then sleep for a few secondsStart-Sleep -Seconds 5. After the sleep get the running process and pipe that into Wait-ProcessGet-Process xboxPcApp | Wait-ProcessScript will pause until you close the XBox Window (Note: you need to have XBox App configured to close and not hide in settings).agajdosi commentedon Jan 3, 2025
Did this issue fall through? Better error message could save a ton of time. Travis Plunk (@TravisEz13)