the herd will follow their leader, so if you control the leader then you control the heard; if the herd doesn't have a leader or you cannot control the leader, then cut them off by blocking their way until they are going in the direction you want them to or have stopped.