After undergoing an operation on his throat, specifically a goitre, he was assigned command of the First Arcièren-Leibgarde, part of the Imperial Guards, on January 21, 1917. Dankl rose to commander-in-chief of the Imperial Guards in February 1918 until he was replaced at that post by Conrad, his former superior officer during his time at the front, the following summer. He returned to the First Arcieren-Leibgarde, where he remained until the end of the Habsburg rule over Austria-Hungary. He was retired from the army on December 1, 1918 and moved to Innsbruck.