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.
#!/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
/*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;}
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: ╔═╦═╗ ┌─┬─┐ ╓─╥─╖ ╒═╤═╕ ║ ║ ║ │ │ │ ║ ║ ║ │ │ │ ╠═╬═╣ ├─┼─┤ ╟─╫─╢ ╞═╪═╡ ║ ║ ║ │ │ │ ║ ║ ║ │ │ │ ╚═╩═╝ └─┴─┘ ╙─╨─╜ ╘═╧═╛
REM any text
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.
Use the following batch file REM This batch file is used to start/stop the oracle instance REM Simply invoke oracle.bat start/stop cls @ECHO off REM ****************************************************************** REM ** Batch file used to stop/start oracle services REM ****************************************************************** if(%1)==(start) GOTO START if(%1)==(stop) GOTO STOP echo Invalid use. Usage is oracle.bat stop/start GOTO END :START REM ** START the oracle services echo Starting Oracle Services REM change the instance/listener names to match what is in your services list NET START "OracleOraDb11g_home1TNSListener" NET START "OracleServiceINNOVATEST" NET START "Oracle INNOVATEST VSS Writer Service" NET START "OracleDBConsoleInnovaTest" NET START "OracleJobSchedulerINNOVATEST" echo Oracle Services Started GOTO END :STOP echo Stopping Oracle Services REM change the instance/listener names to match what is in your services list NET STOP "Oracle INNOVATEST VSS Writer Service" NET STOP "OracleDBConsoleInnovaTest" NET STOP "OracleJobSchedulerINNOVATEST" NET STOP "OracleOraDb11g_home1TNSListener" NET STOP "OracleServiceINNOVATEST" echo Oracle Services Stopped GOTO END :END maovandara
rem=remington
echo "Enter A Number :" read n r=n s=0 rem=0 while [ $n -gt 0 ] do rem=$(($n%10)) s=$(($s+$rem*$rem*$rem)) n=$(($n/10)) done if [ $r -eq $s ] then echo "The Number is Avogadro" else echo "The Number is Not Avogadro" fi
i=2 rem=1 echo "Enter a number" read num if [ $num -lt 2 ] then echo "$num is not prime" 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 "$num is prime" else echo "$num is not prime" fi
Bullet diameter
It depends on what you want to do lets say you want to say something you use a command. ok first off you always need to start the file with @echo off next you want to make it say something with echo so now i have @echo off echo (text goes here) you can modify this so it can go to that begging again , make it green, and delete this text that is spamming the program so you should have: @echo off---> shows you no cmds with it without it you will see the word echo (text goes here) rem start---> makes you a link so you can refer to it with the goto start command :start------>sends you to this link cls-------------> clears screen in program color 0a---------->green echo (msg here)-> shows text that you write there are many more you just have to look them up on youtube an specify what you want to do what i wrote can make you a real ministure begginer batch file like this. copy this into notepad save somewhere as a .bat at the end @echo off rem start :start cls color 0a echo yay pause echo you pause echo did pause echo it pause echo!! pause goto start
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
cho "Enter A Number :" read n r=n s=0 rem=0 while [ $n -gt 0 ] do rem=$(($n%10)) s=$(($s+$rem*$rem*$rem)) n=$(($n/10)) done if [ $r -eq $s ] then echo "The Number is Avogadro" else echo "The Number is Not Avogadro" fi
Case dimensions
#!/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
in rem jx allows a court jurisdiction over any person with respect to a particular item of propery. quasi in rem exists when the court has power over specific persons with respect to specific property under the plaintiff's control