http://www.perlmonks.org?node_id=446017


in reply to Windows .pl file assoc vs. cmd prompt

As far as I understand it, there's not really any way to know that.

Assuming you're using ActiveState Perl, the default action on files of type .pl is (approximately):

"d:\perl\bin\perl.exe" "%1" %*

for values of your AS Perl bin directory, of course. It calls perl, but not in any particularly special way.

You could maybe modify that to include a special option, like

"d:\perl\bin\perl.exe" "%1" "--I-was-double-clicked" %*

but that's an ugly hack, and it'll fail with scripts using Getopt::Long, because (IIRC) those scripts choke and die on command-line options they don't understand.

You might want to look into Win32 and Win32::GUI. I know it's possible to hide your console window using the latter, and if I can turn up the code in which I did that (a couple years ago), I'll post the relevant exemplary bits. I don't know much about the Win32 API interface in general, though, so can't be much help to you there.

HTH; HAND.