×

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 an Expansion Card?

An expansion card is also called an add-on card, or an adapter card is a Printed Circuit Board (PCB) on the motherboard and fixed into an expansion slot. An expansion...

6 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 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.

What is a Cordless Mouse?

A wireless mouse, often known as a cordless mouse, is one that connects wirelessly to a computer. Instead, the mouse makes use of wireless technologies like Bluetooth, RF, or infrared...

4 minutes read.

What does ALT + Q do?

It is a useful shortcut that can open the ‘tell me’ box in recent versions of the Office software. The user has to press the Alt key while holding the...

4 minutes read.

What is a Slide?

A slide is typically a single page of a presentation or lecture. Slides are usually used to present information visually, using text, images, charts, and other media to convey ideas...

4 minutes read.

History of Computers

You might think just like there were no computers available in ancient times, no people can know about computers, but at that time, they had to calculate and compute by...

6 minutes read.

What programs can I use for speech recognition?

Since its inception, voice recognition software has advanced significantly. It can be utilised for a variety of things, such as speech-to-text software and voice commands on desktop computers and mobile...

3 minutes read.

Why am I unable to increase the resolution in Windows?

If you cannot raise the display resolution in Windows, take these actions. Identifying and resolving video driver issues If Windows doesn't let you raise the screen resolution, your video drivers can be...

3 minutes read.

What is a Secondary Storage Device?

A storage unit, a part of the computer system, is a place where the data and instructions that need to be processed are maintained.A storage device is an essential part...

9 minutes read.

Smart Devices

Smart devices are all everyday objects made intelligent with, for all intents and purposes, advanced computing, including mostly AI and machine learning, and networked to form the internet of things,...

3 minutes read.

Autoexec.bat and config.sys Information

Basically, the Config.sys and Autoexec.bat files are made for MS-DOS and Windows 3. x to load the device and operating system to work effectively. The most recent versions of MS-DOS...

7 minutes read.

What is a File System?

A file system is a method that is responsible for managing the space and the data on the system's storage unit. It is also known as the file manager. The...

10 minutes read.

Six Generation of Computer

The main aim of introducing this generation of computers is to bring wireless connection (Wi-Fi, Bluetooth) to connect different devices to the network. This Technology was designed in 1900 and...

3 minutes read.

Understanding file sizes (Bytes, KB, MB, GB, TB, PB, EB, ZB, YB)

Computer Memory Computer memory is the hardware part of the computer that is used to store data. So, The storage device in a computer is called computer memory. Memory is a hardware...

3 minutes read.

What is an ATX Style Connector?

ATX Design in 1995, Intel created ATX (Advanced Technology eXtended), a motherboard and power supply configuration standard to create on previous factor standards like the AT architecture. It was the...

5 minutes read.

What is a Raster?

A horizontal scan line is an image made of lines on the interior of the screen that were traced by an electron beam to generate a raster. These lines can...

3 minutes read.

What is Motherboard?

The motherboard, also known as the mainboard or the baseboard, which is responsible for performing all the basic tasks on the computer. In mac, the motherboard is known as the...

12 minutes read.

What is Website?

Website A collection of web pages is known as a website. The web pages may have a collection of text, images, audio, video, etc. We can also say that website is...

4 minutes read.

What is Autofill?

Autofill is a feature that some computer programs or applications have that automatically fills out fields in forms, saving users time. Autofill is a software function that automatically adds previously...

6 minutes read.