How to prompt for program to open file with using powershell

Wallby 46 Reputation points
2022-08-25T08:36:57.737+00:00

Hello,

I know that Start-Process -FilePath <path to file> opens the file at path to file, however is it possible to, instead of opening with the default program, open the prompt that would open if you would right click on that file and then press Open with -> Choose another app?

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 36,291 Reputation points
    2022-08-26T01:54:50.277+00:00

    Use openwith.

    $ps = new-object System.Diagnostics.Process  
    $ps.StartInfo.Filename = "openwith.exe"  
    $ps.StartInfo.Arguments = "C:\temp\xxxxxxxx.txt"  
    $ps.start()  
    
    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. S.Sengupta 24,476 Reputation points MVP
    2022-08-26T00:19:42.14+00:00
    0 comments No comments

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.