William S. Cook was born around 1845 in Boston, Massachusetts to John and Eliza Cook. He grew up and attended school in Salem, Massachusetts.
He enlisted in the Union army on October 9, 1861, and he mustered in as a private in Company F of the 23rd Massachusetts Infantry. According to his service records, he was 5 feet, 10 ½ inches tall, with black hair and black eyes. The regiment took part in the Battle of Roanoke Island and the Battle of New Bern. He fell ill with typhoid fever in the summer of 1862, and he was discharged for disability on October 13, 1862.
He returned to Salem after leaving the army, and he earned a living as a clerk. He married Elizabeth Mansfield on April 5, 1870, and they apparently had no children. He died in Salem in 1872.