How to use windows env variables in gradle.properties

I have different java homes and I need to spefify java home in gradle.properties with the correct jdk. For this, I have windows environment variables, but I’ve tried to use them in many ways but gradle is not reading the variable content.
Regards