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.
Click "Start" in Windows, and then click "Run." Type in "cmd" and then click "OK" to open a command line window.
Type in "edit" and press "Enter."
Enter the following commands in the open window:
echo %date%, %time% >> log.txt
echo Current date/time is %date%, %time%.
Video of the Day
Click "File" and then "Save." Enter "my_batch.bat" and click "OK." Click "File" and then "Exit."
Type in "my_batch.bat" and press "Enter" to display the current date and time on the computer screen.