Final answer:
A writ that commands a witness to testify at a trial or other proceeding is known as a subpoena, which is different from a warrant, summons, or affidavit.
Step-by-step explanation:
A writ that commands a witness to appear at a trial or other proceeding and to give testimony is known as a subpoena. This legal document is issued by the court or by a party to a legal proceeding and it serves to command the presence of a witness at a legal proceeding.
If the witness fails to comply with the subpoena, they may be subject to penalties, including contempt of court. This is distinct from a warrant, which is issued to give law enforcement the authority to search premises or make an arrest, a summons, which is a notice to appear in court usually addressed to a defendant, and an affidavit, which is a written statement made under oath.