If I invoke the batch file from inside another batch file - I can do this. Lets say I have batch2.bat the inside of which looks like:
@echo off
set TEST_ENV=true
I have another batch file setEnv.bat the inside of which looks like:
@echo off
call batch2.bat
after executing setEnv.bat on command line
if I do "set TEST" it will print: TEST_ENV=true
The same thing if I do from perl like :
my $cmd = "call setEnv.bat";
system( $cmd );
and call the perl script from command line.
then do "set TEST"
It will print : "Environment variable TEST not defined"