Just backtick something like perl -le'print for %ENV' and see what the %ENV looks like. I also seem to recall that Perl doesn't necessarily go through the shell anymore even for backticks - if that's the case, you'll need another way of invoking Perl on the file as Windows itself cannot be made to honour the shebang line. The easiest solution, it seems, would be to just qx/perl scriptname/.