Index | Syntax | Notes Batch



REM--Examples

The following example shows a batch file that uses remarks for both explanations and vertical spacing: @echo off rem This batch program formats and checks new disks. rem It is named CHECKNEW.BAT. rem echo Insert new disk in drive B. pause format b: /v chkdsk b: Suppose you want to include in your CONFIG.SYS file an explanatory comment before the COUNTRY command. To do this, add the following lines to CONFIG.SYS: rem Set country code to France country=033 The following example shows a DEVICE command that has been disabled by using a semicolon (;) instead of the REM command: ;device=c:\dos\ramdrive.sys * Special Batch Examples echo on @ prompt Explorer tips: (Win98, Danish keyboard) @ set c= :: :: In the above line is a Space, both before and AFTER the double colons :: %c%Deletion without recycle bin: Select the file, hold [Shift] & press [DEL] %c%Search a file named ^*. In Explorer, hold Shift, press [~], press [Space] @ set c= @ prompt $p$g @ echo off
:: Tested on Win98. Rem filenames in current directory. % 1 ECHO this 2 the screen (CON) % :: ------------------------------- Don't ECHO this 2 the screen @Echo off % 2 Turn off ECHOing these lines % Rem > ~. *3 Created a zero byte file (~) Rem >>~. 4 This newer changes the size. Pause *5 Type any key 2 continue. . . For %%f in (*.*) do Echo %%f >>~. |rem 6 Add the short filenames 2 ~. Pause >con 7 (see *5) or just click here. Echo ------------------------- >>~. |rem 8 Don't add 25 minus + 1 space rem Don't use 2 many REM's or :: :: same, except add long names > ~. (REM/double colon) is not the same, :: our ~ file is still okay. (see *3) Dir/b/a-d|Find/v "desktop.ini" >>~. More< ~ |rem MORE gets input. Del/p ~ @Cls :: some sense in Danish: @Cls means CLS & Exit (not, elephant please @) :)
-Top- | Syntax | Notes Batch