Can someone explain the difference between calling a perl script via file association versus calling the same script explicitly via perl.exe
?
Apparentl
It looks like it was a known bug in Windows 2000: STDIN/STDOUT Redirection May Not Work If Started from a File Association.
I get the same behaviour you describe with Strawberry Perl on WinXP, however once I created the registry entry described in the above article (even though the reg entry is targetted at Win2K), stdin
works as expected.
For completeness, in case the link above goes away, the reg entry it suggests creating is:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
InheritConsoleHandles
REG_DWORD
Decimal
1
Edit: I ought to add that even though the KB article claims it was fixed in XP SP1, I've got XP SP3 installed. So whether MS have broken this, or never fixed it completely, I can't say!
I know this is an old thread, but it's important to note that Microsoft appears to have reversed the polarity of this setting in Windows 10. No idea why they would do that, but this had me pulling my hair out for a day. See my other posted question (Perl Scripts on Windows 10 run from Explorer but not Command Prompt), and especially the linked MSDN post there.