William Cochrane, 7th Earl of Dundonald

William Cochrane, 7th Earl of Dundonald, (October 1729 – 8/9 July 1758) was a Scottish peer and soldier.

He was born at Paisley, Scotland, the son of Thomas Cochrane, 6th Earl of Dundonald. At the beginning of the Jacobite rising of 1745 he volunteered at the age of sixteen to join Charles Edward Stuart in his rebellion. After soldiers of the city garrison nearly killed him when he demanded entry to the West Gate of Edinburgh, he apparently reconsidered and took no further action to support the rebellion. In 1750, he went to the Dutch Republic, where he served as a captain in the Scots Brigade from 1750 to 1753. Returning to Paisley, he was involved in local affairs for several years. On 21 January 1756, he was commissioned a lieutenant in England in the new-raised 52nd/50th Foot. He was promoted to captain-lieutenant in the 1st battalion of the 1st or Royal Regiment of Foot in Ireland on 2 February 1757.

On the same day, he was also promoted to captain in the 17th Foot in Ireland, which then embarked to take part in the siege of Louisbourg in what is now Nova Scotia, Canada. At the siege he was captain of a company of grenadiers and was killed in action during the night of 8–9 July 1758 in a surprise sortie by the French garrison. He was buried where he died and today a stone to his memory stands between the ruined walls of Louisbourg and the Black Rock.

On his death, his line died out and the title was inherited by his second cousin, Thomas Cochrane, 8th Earl of Dundonald.