The Emergency Command Hologram (ECH) was an extension of the USS Voyager's Emergency Medical Hologram, first imagined in one of the Doctor's fantasies. The program was eventually implemented by Captain Kathryn Janeway on Voyager. Essentially, the ECH was a 'backup captain', intended to take control of the ship in the event of the current command crew being incapacitated for some reason. The ECH possessed information from the tactical databases of all the major strategists in Starfleet, and could incorporate them into its plans for controlling the ship. When the subroutine was activated, his uniform changed to command colors. (VOY episodes: "Tinker, Tenor, Doctor, Spy", "Workforce")
The extension was first envisioned by The Doctor after he had added daydreaming subroutines to his program in 2376. His initial request to Captain Janeway for the subroutine to be added to his program was denied, but after The Doctor demonstrated his abilities in practice, Janeway reconsidered and ordered research into the development of the ECH to begin as soon as possible. (VOY episode: "Tinker, Tenor, Doctor, Spy")
Exactly when the ECH subroutines were completed and added to The Doctor's program is unknown. What is known for certain is that Janeway eventually activated The Doctor's command subroutines in 2377 when tetryon radiation forced everyone to abandon ship. After the ship was abandoned, but before The Doctor could begin repairs, Voyager was attacked by scavengers. He and the computer disabled one ship and evaded the others by hiding in a nebula. He managed to begin repairs, but life support was not yet online when Chakotay, Harry Kim and Neelix returned from an away mission (of course, being a hologram, this was not a severe problem nor a vital system for him to focus on).
After Chakotay and Neelix went to find the rest of the crew, who had been abducted by the Quarren, Kim and The Doctor disagreed about who was superior to the other; Kim was a commissioned officer, but The Doctor had information about all of Starfleet's great strategists. In one battle with the Quarren, The Doctor called up information about a Romulan battle from his tactical database, leading him to use a photonic shockwave against the ships, before retreating. But in the final battle against the Quarren it was Kim's plan to sabotage three escape pods and detonate them once in the enemies' tractor beams that saved Voyager. This provided a lesson to The Doctor about experience. He realized that he was needed on Voyager as a medic more than as a commander, and made peace with Kim before handing back command to rescued Captain Janeway. (VOY episode: "Workforce")
During a trial on the rights of The Doctor initiated when his holonovel was published without his permission in 2377, Harry Kim cited the ECH extension in The Doctor's favor, regarding it as a Human desire to develop and change that a simple hologram, designed merely to do a specific job, would not have been capable of. (VOY episode: "Author, Author")
In 2377, the Doctor, disguised as Chakotay, used Chakotay's codes to transform himself into the ECH. As the ECH, The Doctor had authorization to eject the warp core, which he did. He then escaped from the ship aboard the Delta Flyer II with the warp core to exchange it with the Hierarchy for Captain Janeway's freedom. Both Janeway and the warp core were recovered and returned to Voyager, although The Doctor remained in sickbay for a week out of embarrassment about the "deathbed" confessions he had made while the excess subroutines from the Hierarchy were being deleted. (VOY episode: "Renaissance Man")
In March 2410, the Hierarchy lent one of their ships to the Doctor, who activated his ECH subroutines. This iteration wore command white and four pips on the collar. The ECH commanded his ship during the final assault on Vaadwaur Prime and helped defeat the VSW Vozroz. When Vaadwaur Supremacy leader Gaul was defeated, the ECH transported to Gaul's command center along with the rest of Admiral Tuvok's senior staff to analyze the Vaadwaur's databanks. (STO - The Delta Quadrant mission: "Takedown")