Temporarily set Environment variables with batch file

Camel89 picture Camel89 · Nov 5, 2015 · Viewed 7.9k times · Source

I'd like temporarily set Environment variables like Catalina and Java_Home using a batch file, without making persistent changes.

Changes should be removed after the execution of a web-page.

There's a way to do it?

Answer

Greg picture Greg · Nov 6, 2015

In your file, at the top, use setlocal, when exiting the file, use endlocal.