Writing comments in bat file

It is always a good idea to write comments in your bat-files. Your comments will help you to understand your own bat-files later on. More important: they help others to understand how it all works.

The REM statement

This is the most common way to write comments. Any line in your bat-file that starts with REM is completely ignored by the command-processor.

		 REM This bat-file moves all files in C:\Incoming to C:\ToProcess
		 REM Written by Gert Rijs
		 REM 05/01/2003

Double Colons

Alternatively you can replace the word REM by two colons. This style of comments is not very common, so I would suggest to stay clear from it.

		 :: This bat-file moves all files in C:\Incoming to C:\ToProcess
		 :: Written by Gert Rijs
		 :: 05/01/2003

Block comments

Very often you would like to write multiple lines of comment. Having to write the word REM at the start of each line is getting very distracting. A bigger problem is when you want to edit existing comments and want the result to be nice looking.
A simple solution is to jump over your comments by using a GOTO statement.

		 GOTO EndComment
		 This bat-file moves all files in C:\Incoming to C:\ToProcess
		 Written by Gert Rijs
		 05/01/2003
		 :EndComment


 

From HERE

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s