I have a batch script setEnv.bat that sets environemtn variable say TEST_ENV to true. Then I call this batch script from inside a perl script like my $batch_cmd = "setEnv.bat"; system( $batch_cmd ); Then I run the perl script from the command line, the setEnv.bat sets the environment variable. After the perl script completes, if I do "set TEST" it says: Environment variable TEST not defined. This means that the environment variable is lost when the batch script returned in the perl execution. How to solve this?