Hamilton's bias was towards the army, and in 1810, after fully showing his incapacity for business in Glasgow and Liverpool, he got a commission in the 29th regiment. Twice on active service in the Peninsula, he received a somewhat serious wound in the thigh from a musket's bullet in the Battle of Albuera. He was also in Nova Scotia and New Brunswick with his regiment, which at length was sent to France as part of the army of occupation.