use strict; use warnings; #backticks convert anything sent to stdout into a string #so this should fill $sEnvironment with assignments my $sEnvironment=`wrapper.bat` #now parse $sOutput and store the various VAR=VAL pairs my @aAssignment=split(/[\r\n]+/,$sEnvironment); foreach my $sAssignment (@aAssignment) { $sAssignment =~ /^(\w+)=(.*)$/; $ENV{$1}=$2; }