How should I set a property I want to get from running a .bat file

I want to run a .bat file, and get the output into a property all my projects can see. On Ant, we just used the exec task with outputproperty - how should I do this in Gradle?

btw, I’ve tried creating an Exec Task, and I have the value stored in the standardOutput, but I don’t know to set a property to it.

Nevermind, stupid me. I set the property inside the task without calling project.ext.prop, so it was set in a local scope.

Nevermind, stupid me. I set the property inside the task without calling project.ext.prop, so it was set in a local scope.