In a message to the army carried on state media, Assad said, "If we in Syria were not sure of victory, we would not have had the will to resist nor been able to persevere in the face of more than two years of aggression," the BBC reported.
Praising the troops for "rare courage in the battle against terrorism," Assad said he had "great faith and confidence" in their ability to "fulfill the national mission that has been assigned to you."
Assad visited Syrian troops in the Damascus suburb of Daraya, his first known public trip outside the capital since March 2012, The (Beirut) Daily Star reported.
Syria didn't release details of the visit but Assad's Facebook page showed him in a suit and tie talking to two soldiers.
Rebels held Daraya for months before government troops recaptured the town earlier this year after weeks of fighting.
Regime forces have recently assembled a string of major victories over the rebels, mostly in Homs and around Damascus.
In June, Syrian troops recaptured the town of Qusair near the Lebanese border.
On Thursday, the army shelled part of the Old City of Homs, killing two people, including a child, the Syrian Observatory for Human Rights said.
Notable deaths of 2014 [PHOTOS]