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