during world war 2 nearly ALL factories were told by the government what to make
That’s true, and I was aware of that wartime measure. It’s still central planning, and would not work long term. There have never been, and likely never will be centrally-planned, command and control economies, which are successful beyond the medium term. A method that preserves at least a modicum of free-enterprise is contracting for supplies and equipment. Companies don’t have to be commanded to produce (say) a new stealth fighter or submarine — several of them will enter into a cut-throat bidding process for the right to make those products, and earn a profit.
Profit-seeking companies are the best hope for helpful solutions. Companies, such as GM, Ford & Tesla see the chance to earn prestige and invaluable public acclaim by switching production to ventilators and they have voluntarily begun to do so. I think that approach is far more likely to produce desirable results, than forcing them to do things. When someone is forced to do something, they tend to do the bare minimum to avoid punishment. When they volunteer, they’re more motivated.