[Solved] don’t know how to detect variables using batch [closed]


Use set to change the value of variables and %var% for using them:

set variable=4
echo Variable is equal to %variable%.
pause

Output:

Variable is equal to 4.
Press a key to continue . . .

If you mean you want to know if a variable is defined, just use if defined <variable>:

if defined myVar (echo Defined!) else (echo myVar isn't defined.)

It will output Defined! if myVar is defined, myVar isn’t defined else.

2

solved don’t know how to detect variables using batch [closed]