A direct war with Iran would last a few days, weeks at most if our goal didn't include taking control of the government afterwards. We could take out the large majority of all Irans military infrastructure with 1 single controlled strike. What would be left would be a fledgling army likely too scared to show up to a real battle. Deserters, and surrender in a matter of days following that.
Hell we could probably do the whole thing w/o setting foot on Iranian soil. The only blowback from a direct war with Iran would likely be a string of attacks on American interests by radicals in surrounding countries. Any country that allied with Iran would face the exact same treatment, utter destruction of their military footprint in a one two swoop.
But lets get something clear, a war with Iran would never be long term and a disaster. It would be short, precise and exactly what the American military institution has been training for for the last 50 years. See the gulf war, which lasted officially 44 days I believe but I believe presence lasted for about 7 months total. Iraq who had a sizable military was smacked around like an orca playing with its prey and reminded the world the might of the western militaries.