You can point to a build file and execute the task inside that build file using the below command.
gradle --build-file <file_name>.gradle -q <task_name> gradle -b <file_name>.gradle -q <task_name>
![](https://i0.wp.com/www.heapwizard.com/wp-content/uploads/2019/06/image-12.png?resize=324%2C90&ssl=1)
![](https://i0.wp.com/www.heapwizard.com/wp-content/uploads/2019/06/image-13.png?resize=565%2C98&ssl=1)
You can execute task in any project directory by using the below command
gradle --project-dir <project_directory> -q <task_name>
![](https://i2.wp.com/www.heapwizard.com/wp-content/uploads/2019/06/image-14.png?resize=327%2C93&ssl=1)
![](https://i2.wp.com/www.heapwizard.com/wp-content/uploads/2019/06/image-15.png?resize=587%2C63&ssl=1)
You can execute both of above command together sample below
![](https://i1.wp.com/www.heapwizard.com/wp-content/uploads/2019/06/image-16.png?resize=794%2C245&ssl=1)