Batch Files

Batch Files

Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Index | Next >

REM Command (Internal)

Learning objective: (2) Explain the use of the REM command in batch files


Click on image to enlarge.

The REM command allows developer to put comments or remarks into a batch file. Any line that starts with REM will not be processed during execution. I strongly recommend that you generously comment your batch file. It will greatly assist with any future modification or questions about the role of the batch file. It is a good practice to place at the top of the batch file a line with the name of the batch file, date of creation or modification, and author. Below that, it is good to add a brief description as to the purpose of the batch file. It may seem apparent to you when you create it what the purpose is, but over time you may forget or others may not understand your approach.

Note the remarks that identify the name and author and include a description of the purpose of the batch file. It is a good idea to add the name of the batch file since the batch file may change as it is copied to new locations and purposes.

Name of batch file

All batch files should start with the name of the batch file. Over time, the original name might change but the initial name is still intact.

Date

All batch files should have the date of creation and modification to alert developers of the history of the batch file.

Author

All batch files should have the author's name included so other developers know who created the batch file.

Description

All batch files should have a description as to the purpose of the batch file. Since batch files can be difficult to decipher at times, it is much cheaper to provide the description at development than to ask developers later to spend valuable time trying to decipher what the batch file is doing before they try to modify its contents.

Thinking: Why put developer comments in a batch file?

Key terms: REM, comment

Resources:
To maximize your learning, please visit these Web sites and review their content to help reinforce the concepts presented in this section.

Quick links:
REM @ ss64.com
REM @ Wikipedia

Embedded Resources

Notes on navigation: Click inside the frame to navigate the embedded Web page. - Click outside the frame to navigate this page to scroll up/down between the embedded Web pages. - Click on the frame title to open that page in a new tab in most browsers. - Click on the the "Reload page" link to reload the original page for that frame.

REM @ ss64.com | Reload page | If frame is empty, click on the link to view the page in a new tab or window

REM @ Wikipedia | Reload page | If frame is empty, click on the link to view the page in a new tab or window

Sections: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Index | Next >