I am using a batch file to execute a function but then
the batch file uses JAVA and then if JAVA_HOME does not
exists it results to some crazy error that I can't understand
on the cmd...

So I was thinking that before I execute the batch file
I'll check first if JAVA_HOME exists
how do I do this?

I made some research and found out that
when you execute echo %JAVA_HOME% on the cmd
it actually returns the path of the JAVA file...and returns
%JAVA_HOME% if it does not exist.

However, I don't know how to get the return value
from the cmd. How do you do that?

I know you can store it to a .txt file and
then read the file to get the value but
if there is a way to directly store it
to a variable that would be a better solution
since the return value would be just 1 line.

Thank you in advance.