×

What is REM?

Rem is a short form of the remark. In the system, a file remark is placed to skip line loading. By placing "REM" in front of a line, a remark is created. Using REM remarks the whole line and prevents loading the line. When REM is used along with batch files, and if the echo is off, then line is not shown.

Example

@echo off
REM this line won't be seen when the echo is off
Echo Hello Tutorialandexample!

In the example given above, the first line written after REM won't be seen as it is skipped. Then only "Hello Tutorialandexample!" is seen on the screen.

Another way to remark any line in the batch file is by placing the two colons(::) at the line start. Then these two colons won’t show the line whether the echo is off within the batch file.

:: the line is not seen forever
Echo Hello Tutorialandexample!

REM is a way of inserting remarks into a batch file. In the Windows Command Processor, i.e., Command Prompt REM is present.

REM is used as a command in java as we use "//" to write a command. Rem is an inline command which means that the line is executed as a comment till the end only. It won't be used to write multi-line comments. When the user wants to write multi-line comments using REM, then the user should use multiple Rem commands.

Comments make the code more readable by giving necessary insights to the user. Consider the following code to understand the usage of the Rem command in different scenarios.

  • @echo off
    this command is used in the batch file to prevent all commands from echoing to the screen.
  • echo %~f0
    Here REM displays the full path of the file.
  • echo %~t0
    REM displays the timestamp of file creation.

REM used to create an inline comment

As discussed, Rem is an inline comment; let’s see an example

REM this code is used to display hello
echo hello! 

REM used to create multi-line comments:

We should use multiple Rem commands for creating multi-line comments, as in the code snippet.

REM this code tells the time
REM displays time until milliseconds
REM the time is given basis on the current time zone
echo | time 

In the above example first three lines are comments that describe the functionality of the last code line.

One more important point in the REM discussion is that a single quotation mark ( ' ) can also be used as an alternative to REM.

Example

REM this is a comment
 ' This line is also a comment

Hiding the REM lines from showing in a batch file

REM command is used to remark the lines. By remarking the lines, the main use is that line is skipped from execution. But one main problem is that if the @echo off is not placed in the batch file, then still the lines will be echoed to the screen without the skip.

To prevent the lines from echo to the screen, there are three ways as follows:

  1. To the batch file adding @echo off
    Adding @echo off in the batch files first hides all the commands along with REM lines.
  2. Interchange REM with @REM
    When the user wishes to show the commands even if the batch file is running, but if the user hides the REM lines, then use @REM instead of REM.
  3. Using "::" in place of REM
    Usage of "::" instead of REM as the remark command halts the remarked line echo.

In the above blog, we have been discussing the batch files, so we will understand what these batch files are to get full clarity of the topic.

What is a Batch file?

A batch file can be either of the following explanations.

  • A batch file, sometimes also referred to as a batch job, is a processing of a group of commands in sequence without the requirement of user intervention (i.e., without having the user input). Batch files are used for loading programs and running multiple processes simultaneously, and they are also used to perform repetitive or common tasks.
  • A batch command executes several commands, and a batch command is a Recovery Console Command.

Related Topics

What is Access Time?

Access time is when a computer can recover data from a storage device, such as a hard drive or solid-state drive. It is an important factor that can affect the...

7 minutes read.

Computer: CPU (Central Processing Unit)

What is CPU? Explain its block Diagram The Central Processing Unit is known as the central processor or main processor. The CPU is an electronic circuitry within the computer which can...

5 minutes read.

What is SAN?

A storage area network, sometimes known as SAN, is a specialized, quick network that provides network access to storage devices. Hosts, switches, storage components, and storage devices make up standard...

7 minutes read.

Computer: Registers Memory

Registers in Computer The Registers are the type of computer memory, which is used to accept, store quickly, and transfer the data and instructions that are immediately used by the CPU (Control Processing...

5 minutes read.

What does Alt+R do?

Alt+ R The Alt button is adjacent to the spacebar in the keyword. The Alt key is used with many other keys to perform various functions. When the user uses R...

4 minutes read.

How to fix problems in Windows after installing new software

Sometimes users face problems after installing new software in the windows operating system. Go along with the below steps to correct and fix them. Uninstall the software program or reinstall it If...

4 minutes read.

What is AR lens?

The full form of AR is the anti-reflective lens. AR is a type of optical coating that is applied to the plain of the lenses and other optical elements to...

6 minutes read.

How to open the Windows My Documents or Documents folder

Documents or My Documents (known in earlier versions of Windows such as Windows XP) is basically an in-built directory provided by Microsoft Windows. This is a very valuable directory that...

5 minutes read.

Parts of Computers Names, Definitions and Images

Computer: A computer is an electronic device, which is made up of using various hardware. The computer processes data, performs calculations, and communicates with other devices and systems. Hardware refers...

14 minutes read.

What is open with?

You can open a file with your chosen program by using Windows' Open With function. The software that opens those files may not be the normal Windows program. When you...

3 minutes read.

How to choose which items show in the notification area

Icons in the notification area, also known as the system tray, contain information for users about several features of their operating system. Examples include the date and time, the state...

3 minutes read.

What does Alt+B do?

Generally we can do all the operations with the help of mouse and keyboard. Whatever we want to do, mouse is essential part of the computer system. But it takes...

3 minutes read.

Difference between File and folder

File: A file is a unit of Storage for comparative data. A document can be a picture, video, executable record, framework, or application document. Secondary storage options include DVDs, flash drives, SSD...

3 minutes read.

What is Cable Modem?

A common piece of gear that links computers to your ISP is the cable modem. A cable modem, unlike other types of modems, uses coax cable to proxy that connection...

7 minutes read.

Difference between Website and Webpage

Website A website is a collection of attached web pages, typically supplied from a single web domain, accessible via the Internet. A website is hosted on a computer system known as...

6 minutes read.

How to fix missing Microsoft Windows .dll files

Users who experience missing.dll issues or other .dll-related error messages can find assisted on this website. If you're experiencing a single missing.dll error, we recommend searching for that.dll file on...

9 minutes read.

How to Open Safe Mode?

The Safe mode is a diagnostic mode in Windows that starts the operating system with a minimal set of drivers and files. It is designed to help troubleshoot and fix...

10 minutes read.

What is a Device?

Generally, when we hear this term named "Device", we have a perspective that it may either be some kind of electronic equipment or a machine built to work for a...

3 minutes read.

What is Microphone?

Microphone is an input device that converts audio or any sound vibration into electric signals, and saves the audio in digital or analog format. It was invented by E. Berliner...

10 minutes read.

What is Right-Click?

The right-click, often known as RMB (right mouse button), results from depressing the right mouse button. A computer mouse's right-click function can launch extra functionality, typically in the form of...

3 minutes read.