Add comment in batch file windows 10

Thumbnail contains a batch file and a computer keyboard

You can use rem to comment out any part of a batch file that you don’t want to run; 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 post, 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. The YouTube folder is located in the root of the partition letter C of my 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, open a text editor such as Microsoft Windows Notepad, and then type the command below.

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

Give the file a name and save it with the bat extension.


When you run the batch file, a new text file name current-news will be created in the YouTube directory.


What To Read Next


If you like the content of this post or if it has been useful to you, please consider sharing it on your social media and follow me on Facebook and Twitter for more exclusive content.