This is an idiom which means that the Spirit of God influenced Zechariah and enabled him to prophesy. See how you translated a similar phrase in [2 Chronicles 15:1](../15/01.md). (See: [[rc://en/ta/man/translate/figs-idiom]])
Zechariah asked this rhetorical question to rebuke the people. It can be translated as a statement. Alternate translation: "You are transgressing the commandments of Yahweh, so that is why you cannot prosper." (See: [[rc://en/ta/man/translate/figs-rquestion]])