To run a Kotlin script one needs to execute:
kotlinc -script myScript.kts
Do I need to download the Kotlin command-line compiler to have access to it, or there is an easier way?
Kotlin scripting is the solution to this problem, but it is still experimental, and it didn't work for me very well.
I ended up using Gradle Kotlin DSL. Here is a nice samples repo to get you started fast.