During the Interregnum Sir William joined Charles II in exile. He commanded Lord Newburgh's regiment of Scots at the Battle of the Dunes (1658). After the Restoration he was appointed colonel of the royal guards in Scotland.