People crowded into the Frank Center Theater while a warm spring day was in the offing outside.
"I mean, gosh, we should be outdoors," said Hamlisch, who grumbled about the nonstop rains he had to endure in New York last week.
"But I will do the best I can," Hamlisch said.
Hamlisch's achievements include winning four Grammys, three Oscars and the Pulitzer Prize. In 1994, Hamlisch was the musical director and manager of Barbra Streisand's U.S. tour.
About 500 people paid $50 a ticket to hear Hamlisch. His performance was to raise money for the school's new Fazioli piano, a rare Italian-made piano known for its luxurious range of sound.
After a few opening lines, Hamlisch sat down to the long, elegant piano.
It was only Hamlisch and the instrument, which was backlit in a soft blueish color, on stage.
Hamlisch took to the keyboard, his clear, crisp notes rolling and tumbling over each other. He moved occasionally to the lower end of the piano, his arms barely moving at times but churning out deep, rumbling sounds.
The crowd responded with eager applause and clapped along on "They're Playing Our Song."
In Hamlisch's "Rent-A-Composer" segment, audience members were invited to come up with a song title, for which Hamlisch would formulate a song.
In humorous exchanges with the audience, Hamlisch passed on one woman's suggested song title about a dog and another one's title "Hot Ice." He then took interest in a woman's suggested song title of "Love is Eternal."
"If there are any divorce attorneys here, they will want to shoot you," Hamlisch said.
Hamlisch then launched into the on-the-spot composition, setting the scene with a man who comes home to his wife at 2 a.m. with lipstick "over here and over there."
"That's when Hillary had to be tough with Bill," Hamlisch sang.
In another exchange with the crowd, Hamlisch said people often ask him how a song is written. Sometimes, the song comes as a result of a title, Hamlisch said.
Such was the case with "The Way We Were," the classic song that Streisand helped make popular in the 1973 film of the same title. Hamlisch said when he heard the title, he knew where to go with the song.
"I could practically hear the notes," Hamlisch said.
His performance was divided into two sets. He closed out the first set with "The Way We Were."
Audience members were impressed with Hamlisch's performance.
"Excellent" was how Shepherdstown resident Chris Polank described the first set.
"I didn't expect the type of entertainment we received for a composer. He's a genius," Polank said.
"I think he's incredible," said Cathy Murray of Shepherdstown.
Hamlisch's appearance was part of Shepherd College's "Year of the Piano," the highlight of which is the school's effort to raise money to buy the Fazioli piano.
Shepherd officials said the school could be the first on the East coast to own such a piano.
Mark McCoy, chairperson of Shepherd's music department, has declined to say how much Shepherd had to pay for the piano, but they retail for about $140,000.
The school was able to get a good deal on its Fazioli from a Leesburg, Va., shop known as The Piano Co., McCoy has said.
At the beginning of Sunday's performance, McCoy told the crowd that the music department is only about $8,000 shy of the money it needs to pay for the Fazioli.
"I think that's a great testament to the folks of Shepherdstown," McCoy said.
Hamlisch's performance was one in a series of "Year of the Piano" concerts. The final concert will be April 30 when the Shepherd College Wind Ensemble and pianist Scott Beard will perform George Gershwin's "Rhapsody in Blue" beginning at 8 p.m.
Tickets are still available for the show. For more information, call 304-876-5555.