How to Display Text with a BAT File

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.

A batch file is a text file that includes the lines of Microsoft DOS commands. DOS batch files have the .bat file name extension. Batch files are useful to automatically execute programs in a sequence and to automate the computer tasks that require multiple or repetitive steps. You can use the ECHO command in a batch file to see text messages on the computer screen. By displaying text messages included with the .bat file, you can monitor its execution.

Advertisement

Step 1

Click "Start" in Windows, and then click "Run." Type in "cmd" and then click "OK" to open a command line window.

Video of the Day

Step 2

Type in "edit" and press "Enter."

Advertisement

Step 3

Enter the following commands in the open window:

echo off

echo %date%, %time% >> log.txt

Advertisement

echo Current date/time is %date%, %time%.

Advertisement

@pause

exit

Step 4

Click "File" and then "Save." Enter "my_batch.bat" and click "OK." Click "File" and then "Exit."

Step 5

Type in "my_batch.bat" and press "Enter" to display the current date and time on the computer screen.

Video of the Day

Advertisement

Advertisement

references