Good God, son!
War is easy to throw into a game, but takes a lot of work to do well. Personally, I like to keep PCs out of the chain of command. As others have shared, players sometimes balk at taking orders. This is an escape for many of them, after all. Keeping that in mind, I usually use the war as scenery, motivation, and a seemingly unstoppable force.
My PCs might quest to find some McGuffin that could end the war. A legitimate heir to the throne of a country wracked by civil war, the tomb of Gith to turn the tables on a Githyanki invasion, the Aritifact of War Ending (trademark pending,) something like that. In these scenarios, the campaign plays out with typical research, exploration and dungeon diving. It feels like every other generic campaign.
If the PCs have relationships with powerful people things might play out differently. Old quest-givers may return to their valued outside-the-box contacts when they need high-value targets removed from the battlefield, or outright assassinated. The PCs might be tasked with delivering documents to or from the front, between garrisons, or even direct communication between waring parties. They could act as spies or counterspies. They may even assume command of units or fortifications for short periods, but never for major battles.
Sometimes my players won't even bite at the war storyline, but try to carve out a niche for themselves in the chaos. This can be a lot of fun, especially for morally questionable PCs. I get to describe the effects the war has on every aspect of the campaign world, often taking inspiration from the players' questions. They try to ally with, betray, tripple cross, and play every major force against one another for their own personal gain. Sometimes they dungeon dive for loot or magic, but most of the energy is spent on social maneuvering and clandestine eliminations.
PCs running armies... this isn't really the system I'd use for that, but it has happened.