In this post, I will show you how to add comment to a Windows batch file. You can use rem to comment out any part of a batch file that you don’t want to run in a Windows batch file; And it’s a good practice to include comment on your batch file because people tend to forget important details when they have done something for a while.
In this batch file, I will comment out the creation date of the script, the name of the website and the description of the script to help you remember what the script does.
The batch file will create a text file in my YouTube directory which is located in the root of the partition letter C of my Microsoft Windows 10 computer. The file contains today’s date, time and the current version of Microsoft Windows on the computer.
To create the batch file, I will use the text editor notepad from Microsoft Windows.
rem date of creation: April 10, 2020
rem website: htopskills.com
rem description: This batch file creates a text file name current-news in the YouTube directory which is in the root of the partition c. The file contains today's date, time and the current version of Microsoft Windows installed on the computer.
date /t > c:youtubecurrent-news.txt
time /T >> c:youtubecurrent-news.txt
ver >> c:youtubecurrent-news.txt
After executing the batch file, a new text file name current-news will be created in the YouTube directory.