Cox had served in the Wiltshire militia before being commissioned as ensign in the 117th Regiment of Foot on 11 July 1795, transferring on 23 January 1796 to the 68th Regiment of Foot. He was promoted to lieutenant in the 68th Foot on 21 February 1797. He transferred to the New South Wales Corps on 30 September 1797, having changed places with a certain Lieutenant Beckwith, and was made paymaster on 23 June 1798. Cox sailed for New South Wales on 24 August 1799 on the Minerva, with his wife and four sons. Aboard the ship were around 160 convicts, including Joseph Holt and Henry Fulton who were among many political prisoners. Cox used his influence so that the prisoners were often allowed up on deck for fresh air, and Holt in his memoirs states that as a result "the ship was the healthiest and best regulated which had ever reached the colony". The Minerva arrived in Sydney on 11 January 1800. Cox purchased a farm and made Holt its manager. Further land was purchased but in 1803 large liabilities led to Cox's estate being placed into the hands of trustees. He was suspended from office due to allegations that regimental accounts were involved. Cox returned to England in 1807 to answer allegations that he had misused army funds. The Dictionary of Australian Biography records that Cox was cleared in 1808, and was promoted to Captain of 102nd Regiment of Foot, and placed in charge of Irish political prisoners. However, the London Gazette of 19 April 1808 records, "Paymaster William Cox, of the New South Wales Corps, is dismissed the Service."
Building career
In 1811 Cox returned to Australia. Once back there, he resigned his commission and became principal magistrate at Hawkesbury. He was also responsible for erecting many government buildings. In 1814, Governor Lachlan Macquarie approved Cox's 'voluntary offer of your superintending and directing the working party' that would build a road crossing the Blue Mountains, between Sydney and Bathurst. The completed dirt track was wide by long, built between 18 July 1814 to 14 January 1815 using five free men, 30 convict labourers and eight soldiers. Macquarie surveyed the finished road in April 1815 by driving his carriage along it from Sydney to Bathurst. He commended Cox and stated that the project would have taken three years if it had been done under a contract. As a reward Cox was awarded of land near Bathurst. The road became known as Cox's Road and over time much of it has been bypassed in favour of easier grades.