What is the conceptual difference between running "./gradlew shared:build" vs "./gradlew -b shared/build.gradle build"

I have noticed that the two approaches in the title do not behave in the same way, for example the latter will run the specified task for all sub-projects where as the former will just run the task for the specified project only.

I would expect both to behave the same, since in both cases the same task is being executed, so I am wondering conceptually what is the difference in meaning between the two approaches given in the title?