I have two node js files and one bat file. In the first js file, I am setting a few environment variables and in another js file, I want to access it. However, after setting variables, I am unable to find these variables in another file.
Example,
file1.js
process.env.dev_url=example.com
file2.js
console.log(process.env.user); // This returns correct value as [email protected]
console.log(process.env.dev_url); // returns undefined.
runner.bat
ECHO on
SET [email protected]
node file1.js
node file2.js
After running runner.bat, I can get the value of the variable user
in file2, but not the other ones set in file1.js, what could be the reason, and how can I get these values in file2?