echo Command In Windows

The echo command is a very popular command for multiple operating systems. echo command is used to print some text or variable values into the standard output. The standard output is the terminal or console by default but the standard output can be also a peripheral or COM port too. In this tutorial, we examine the echo syntax and examples.

echo Command Support for Windows

The echo command is a very old command which is supported by all versions of Windows. Windows versions supporting the echo command are listed below.

  • All Versions of MS-DOS
  • Windows 95
  • Windows 98
  • Windows ME
  • Windows NT
  • Windows 2000
  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8
  • Windows 10
  • Windows 11

echo Command Syntax

The echo command has a very simple syntax.

echo OPTION MESSAGE
  • OPTION is ON or OFF where the echoing is enabled or disabled.
  • MESSAGE is the message or data we want to echo.

Create or Overwrite File with echo Command

We can use the echo command in order to create and put some data into a file. The file is formatted as an ASCII text file. If the specified file contains some data the data is overwritten. The > is used to redirect the message into the specified file.

echo "I like windowstect.com"  > myfile.txt

Add Text to File with echo Command

We can add or append some text to the existing file without deleting the files existing content.

echo "I like windowstect.com"  >> myfile.txt

Send Data to COM1,COM2,COM3 with echo Command

We can also use the echo command in order to send data into the COM ports like COM1, COM2, and COM3.

echo ata > COM2

Leave a Comment