Java IOException when trying to execute gradle

I’m getting the following error when I’m executing gradle.bat or even gradle -version.

 FAILURE: Build failed with an exception.

* What went wrong:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect

Environment details:
Gradle: 4.10.2
OS: Windows 10 Enterprise
JDK Version: “1.8.0_66”