Open a file with an Powershell Studio generated exe and catch filename in variable?

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
stevens
Posts: 493
Last visit: Mon Sep 19, 2022 12:23 am
Has voted: 2 times

Open a file with an Powershell Studio generated exe and catch filename in variable?

Post by stevens »

Hi,

In short: see below: I'd like to catch a filename by a PS generated exe in a variable, then do stuff with it.
Would appreciate your any input to make this work!

--full explanation---
I'd like to check 3 scenario's:
1.doubleclicking an (to Windows) unknown filetype (f.e. a mypicture.gimp which is linked to Gimp program, but not installed) would open an (by Ps Studio) generated exe that sees the .gimp, matches it to the Gimp program and then offers to install Gimp
In this scenario, I'd link the unknown filetypes to the own created .exe, which is pretty straight forward (adapting the xml)
2.same scenario as above, but when Windows would offer a program to open and I choose the own created exe, same scenario as above happens (offer to install Gimp)
3.right mouse button on any program shows option openwith 'MyExe', then I offer options with what it could open and offer to install (Gimp or whatever other options)
=> All 3 scenarios would require the exe to catch the filename in a variable, rest is easy of course (f.e. $file = Myfile.gimp, match .gimp to program Gimp and popup with question to install).
---
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Open a file with an Powershell Studio generated exe and catch filename in variable?

Post by jvierra »

See:

cmd /c assoc /?
cmd /c ftype /?


Once you associate the extension with your EXE then will have the filename.

The only other legal way to do this is to write a shell extension that handles all unrecognized extensions and have it do what you ask.
This topic is 4 years and 9 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked