During the 1862 Maryland Campaign, his regiment was a part of Ripley's Brigade in D. H. Hill's Division. It helped in the defense of South Mountain before withdrawing towards Sharpsburg, Maryland. When General Roswell Ripley fell with a wound at the Battle of Antietam defending Mumma's Farm, Doles assumed temporary command of the brigade and led it in an assault into the southern end of the Miller cornfield. Doles's command of the brigade was made official on November 1, 1862 with his promotion to brigadier general. He led the brigade with efficiency during the battles of Fredericksburg and Chancellorsville.