answersLogoWhite

0

rem is a comment that is only seen if you edit the batch

echo actually is printed when the batch is running

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
JudyJudy
Simplicity is my specialty.
Chat with Judy
BeauBeau
You're doing better than you think!
Chat with Beau

Add your answer:

Earn +20 pts
Q: What is the difference between rem and echo in batch?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you add comments in batch files?

Anytime you wish to create any type of remark in a batch file rem must be added in front of the line. Remarks are often used to skip a line in the batch file or make comments.


Shell program for finding prime number?

#!/bin/sh i=2 rem=1 echo -e "Enter a number: \c" read num if [ $num -lt 2 ]; then echo -e "$num is not prime\n" exit 0 fi while [ $i -le `expr $num / 2` -a $rem -ne 0 ]; do rem=`expr $num % $i` i=`expr $i + 1` done if [ $rem -ne 0 ]; then echo -e "$num is prime\n" else echo -e "$num is not prime\n" fi


Write a shell program to check odd or even number?

/*Programming in C...*/#include int main(void){int n ;printf("enter a number :");scanf("%d",&n);if(n%2==0){printf("no is even\n");}elseprintf("no. is odd\n");return 0;}


How do you enter Unicode or Alt Codes into a Batch File?

Batch files must be saved in ANSI format because that's the only format the CMD shell natively supports. If you save the file in any one of the Unicode formats (UTF8, UTF16, etc) the batch will not execute or will execute up until the first unrecognised symbol, especially if the file also contains a byte-order-mark (BOM). While the batch file itself must be encoded in ANSI, that does not mean you are limited to just 256 characters. By changing the code page, the same encoding can represent any character you want, you simply need to know in which code page it resides. Whilst editing your batch file, there can only be one code page in effect so any characters you've already entered using a different code page may not display correctly. However, this effect is temporary since changing the code page doesn't change the encoding, it only changes the way that encoding is interpreted by your text editor. Your batch file will also need to include the CHCP command to change the console code page accordingly as it is executed. However, before you switch code pages, remember to save the current code page so that you can restore it when you're done. This is particularly important if your batch file might be invoked as part of another batch file. If you don't restore the code page, the other batch file may not work as intended. Also, never assume that the current code page is always going to be the system default code page because the default depends on the locale. Always leave things exactly as you found them. As an example, suppose we wish to display the full range of box drawing characters found in code page 437. Here's how our code will appear in the editor: @ECHO OFF REM Save the current code page. FOR /F "tokens=*" %%A IN ('CHCP') DO FOR %%B IN (%%~A) DO SET codepage=%%B CHCP 437 > NUL ECHO ÉÍËÍ» ÚÄÂÄ¿ ÖÄÒÄ· ÕÍÑ͸ ECHO º º º ³ ³ ³ º º º ³ ³ ³ ECHO ÌÍÎ͹ ÃÄÅÄ´ ÇÄ×Ķ ÆÍØ͵ ECHO º º º ³ ³ ³ º º º ³ ³ ³ ECHO ÈÍÊͼ ÀÄÁÄÙ ÓÄÐĽ ÔÍÏ; REM Restore the original code page. CHCP %codepage% > NUL Don't worry about all the hieroglyphics, that's simply how Windows-1252 interprets the encodings and is how Windows Notepad will display your batch file. To see the correct symbols you will need to use an editor that supports OEM-US encoding such as Notepad++. When you execute this batch file, you should see the following output: ╔═╦═╗ ┌─┬─┐ ╓─╥─╖ ╒═╤═╕ ║ ║ ║ │ │ │ ║ ║ ║ │ │ │ ╠═╬═╣ ├─┼─┤ ╟─╫─╢ ╞═╪═╡ ║ ║ ║ │ │ │ ║ ║ ║ │ │ │ ╚═╩═╝ └─┴─┘ ╙─╨─╜ ╘═╧═╛


What is a syntax for REM statement?

REM any text