Forum Discussion
wallby
Aug 24, 2022Copper Contributor
How to prompt for program to open file with using powershell
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?
Answer was given here.. https://docs.microsoft.com/en-us/answers/questions/981421/how-to-prompt-for-program-to-open-file-with-using.html
The answer..
Use openwith.
$ps = new-object System.Diagnostics.Process $ps.StartInfo.Filename = "openwith.exe" $ps.StartInfo.Arguments = "C:\temp\xxxxxxxx.txt" $ps.start()
2 Replies
Sort By
- farismalaebSteel ContributorThanks for sharing it back... I was waiting for the answer 🙂
- wallbyCopper Contributor
Answer was given here.. https://docs.microsoft.com/en-us/answers/questions/981421/how-to-prompt-for-program-to-open-file-with-using.html
The answer..
Use openwith.
$ps = new-object System.Diagnostics.Process $ps.StartInfo.Filename = "openwith.exe" $ps.StartInfo.Arguments = "C:\temp\xxxxxxxx.txt" $ps.start()