in reply to Best ways to run a windows batch with Perl

Basically, the code in Get default login environment respectively its replies should allow you to read all the environment variables a shell script sets.

You will need to learn about how your shell (cmd.exe) invokes batch files and how you can run your own code in the context of such a batch file, but it's not hard. The following code works for me to retrieve the environment for a batch file under Windows:

my $batchfile= 'C:\\test.cmd'; my $cmd= qq("$batchfile" && set); print "Environment: $_" for `$cmd`;

... where test.cmd contains

set TEST=C:\test.pl

You should easily be able to combine this part with the parsing parts of Get default login environment into something that retrieves the environment under Windows.