Mayor Bill de Blasio had been under enormous pressure in recent days to close the schools as New York City attempts to slow down the spread of the coronavirus. The mayor said laptops would be lent to students who do not have computers at home, and the city will work on helping families who do not have internet access.

Next week, the city will move to remote learning, with several dozen school buildings used as centers to support the children of essential city workers like health care employees.

The closure has thrown parents’ work lives for a loop, with some receiving the message late.

Steven Wu, 50, arrived at Yung Wing Elementary School in Chinatown in Manhattan on Monday morning only to discover that his 5-year-old daughter had no class. The principal tried to walk him through how to use a phone app that allows parents to communicate with the school.

“It’s a huge headache,” Mr. Wu said in Cantonese.

Shortly afterward, Yan Hua Chen arrived to pick up meals for her two children and the five others in her extended family who live in her apartment building.

She said she had quit her job at a restaurant to care for her children during the school closure.

Those who already work from home still found it difficult to refocus their attention. Ismail Dale, an artist who lives in the Brownsville neighborhood of Brooklyn, now has to look out for his son, Trabon, a sixth grader at Public School 364. “I had to cancel a lot of things,” Mr. Dale, 60, said.