The Change of Command is a brief formal ceremony whereby one commanding officer steps down and another assumes command of a particular starship or space station. The ceremony is usually forgone for temporary command transfers.

In the 24th century, the ceremony was as follows:

The command " Attention to Orders" is given. The outgoing CO reads the formal order: "To (outgoing CO), Commanding Officer, (command being relinquished). (date the order is given). You are hereby requested and required to relinquish command of your vessel to (incoming CO), Commanding Officer, (incoming CO's former command, if any) as of this date. Signed, (authority issuing order)."
The outgoing CO then states: "Computer, transfer all command codes to (new CO). Voice authorization: (outgoing CO's security code)."
The computer replies: "Transfer complete. (command) now under command of (new CO)."
The incoming CO approaches the outgoing and says "I relieve you, sir." And the latter replies "I stand relieved." (TNG: "Chain of Command, Part I", DS9: "The Dogs of War", Star Trek)