Comments in Batch-Scripts (BAT-Files)
Question by Guest | Last update on 2023-11-16 | Created on 2014-10-15
Some of my batch scripts have become longer over time and thus are increasingly confusing for me. That is why, I would like to write some comments to my batch files, so that I can remember what the specific part of the script is doing there.
Is it possible to insert a comment to a BAT-file? All of my previous attempts have only let to error messages because Windows have tried to execute the corresponding line of the script.
Related Topics
Rewrite Text Files with a fixed Line Length
Tutorial | 0 Comments
Repair Text Files with mixed Line Breaks
Tutorial | 0 Comments
YUI Compressor: Keep Some Comments
Info | 0 Comments
Website Performance: Deliver JavaScript and CSS files compressed to reduce loading times
Tutorial | 0 Comments
Windows Batch Script: Computer Shutdown
Tutorial | 0 Comments
Convert many CSV Files to XLSX or ODS Spreadsheets
Tutorial | 0 Comments
Program in ZIP-Folder
Info | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
When starting a line with REM or :: this line is interpreted as comment.
Here is an example:
Please take care of inserting a space or tab after each REM, otherwise it is not working. You do not have to care about this when using the double colon.
Additionally, you have to consider that REM and :: always have to be at the beginning of a line. If you would like to write a comment at the end of a line or after any of your other batch-commands, you can use the following syntax:
After a command, you have to use "& REM" or "& ::" to initiate a comment.
Last update on 2023-11-16 | Created on 2014-10-15