in reply to Changing parent process environment variable
If the parent is a Perl script:
chomp( my @cmds = `child` ); foreach my $cmd (@cmds) { next unless /^set\s+(\S.*?)=(.*)/i; $ENV{$1} = $2; }
If the parent is a batch file:
for /f "usebackq delims=" %%f in (`child`) do %%f
The child would output such as
orecho set VAR=5
print("set VAR=5\n");
Update: Added second snippet.
|
---|