This was later relaxed to 'Black Jack,' which became Pershing's nickname. With the outbreak of the Spanish-American War, Pershing was brevetted to major and returned to the 10th Cavalry as the regimental quartermaster. Arriving in Cuba, Pershing fought with distinction at Kettle and San Juan Hills and was cited for gallantry. The following March, Pershing was struck down with malaria and returned to the US. In 1917, as America entered World War I, General John J. Pershing was appointed commander in chief of the American Expeditionary Force (AEF) to assist the Allied powers against German forces.

When the United States entered World War I in 1917, Pershing was given the command of the American Expeditionary Force.

This was not a good time for a war for the Army. There were limited supplies, no aircraft for an army still struggling with recruitment and organization.
There was a diplomatic mountain to scale as well: the French and the British expected the Americans to serve under their commands. Pershing refused, and successfully demanded separate camps for his men as well as training by American officers and sergeants.
In June 1918, the Germans launched a major offensive to capture crucial bridge crossings at the Marne River in France. Throughout the month, the American Expeditionary Force waged defensive and counteroffensive warfare against the Germans at the bloody Battle of Belleau Wood.
In mid-July, the American Expeditionary Force was again tested at the Battle of Chateau-Thierry. Victories in both these engagements led to the end of the last major German offensive of the war.
In September 1918, Pershing successfully led American and French forces in an offensive against the German line in the Saint-Mihiel salient. This victory proved the competency and quality of the American troops and was followed by the final offensive of the war, Meuse-Argonne.
Black Jack Pershing World War 1 Battles

World War I John J Pershing
The slow, bloody advance of Allied troop progressed until November 11, 1918, when an armistice was finally declared.