How to run a CMD file in directory relative to the project

Is there a way to specify the task should run after all tasks given in the command line?

Same as outside. Doesn’t make much sense to put it inside then.

Can you give an example as I am very confused with this option at the moment.

You really need to take a step back and try to learn Gradle (and perhaps some Groovy) from ground up. Otherwise, you’ll always be struggling.