$ cd $(dirname `which midl`)
dirname: too many arguments
というエラーがでます。
おそらくProgram Filesと空白が入っているためです。

こういったケースは皆さんどうしてますか?