Following the outbreak of World War I, Gerok was appointed commander of the 54th Reserve Division (2nd Royal Württemberg) on 25 August 1914, and on 30 August promoted to the rank of infantry general. He was succeeded as divisional commander by Infantry General Paul von Schaefer and on 11 September 1914 appointed general in command of the XXIV Reserve Corps. He led them in battle first on the Western Front in the Battle of Lille (26–28 October 1914) and the First Battle of Ypres (30 October–22 November 1914). The corps were then withdrawn and sent to the Eastern Front, where they first saw action at the Battle of Łódź. From 13 May until 9 August 1916, they took part in the Battle of Verdun and then moved into the Carpathians, where Gerok also served simultaneously until 24 November 1917 as commander of the Army Group named for him. He led the corps in the battles for terrain in Champagne and at Rheims, until 18 February 1918. He was then relieved and once more appointed Governor of Ulm. He carried out this function until 22 May 1918, when he was unassigned until his final dismissal from duty on 10 June 1918. With effect from that date, he was assigned "à la suite" to the "King Karl" Grenadier Regiment (5th Württemberg) No. 123 by King William II of Württemberg.