Batch processing has many techniques and can accomplish many things that can't be done well in Windows.
@echo off //Cancel the display of command operation on the screen
echo. |date| find "Current" //Only display the date
echo. |time| find "Current" //Only display the time
:: //Equivalent to rem
call //Call another batch file
del %0 //Self - delete
if "%1" == "string" goto //For example, if "%1" == "/p" goto p
if "%1" == "string" command //if "%1" == "/p" dir /w/p c:
if exist file command //Run the command if the file exists
copy /b //Merge files
fdisk /mbr //Uninstall the master boot record. If the master boot record is overwritten by LILO, it can be used to clear it
prompt $p$g //Restore the prompt
echo Free and Open > new DOS.txt //Write Free and Open into new DOS.txt
echo Happy New year >> new DOS.txt //Continue to write Happy New year into new DOS.txt
lh //Load the device into the upper memory. For example, lh smartdrv /x
mode 80 Restore the default display settings
mode mono Activate the monochrome display
mode con:cols=40-80 lines=25-50 //40-80;25-50 are parameters
Keyboard control
mode con:rate=32 delay=1 //Agile
mode con:rate=20 delay=4 //Accurate
mode con:rate=20 delay=2 //Default
Print control
mode com1:9600,8,N,1 //Fast
mode lpt1=com1
mode com1:2400,8,N,1 //Slow
mode lpt1=com1
echo Hello > prn //Test printing
Install CD - ROM
Add in config.sys
devicehigh=boot\CD-ROM.sys /d MSCD001
Add in autoexec.bat
path boot
mscdex /d MSCD001 /m 12
//CD-ROM.sys can be replaced by universal CD - ROM IDE.sys
//Menu display, selection
echo 1.
echo 2.
echo 3.
...
echo 9.
choice /c:123456789 /n Please choose:
if errorlevel 9 goto 9
if errorlevel 8 goto 8
if errorlevel 7 goto 7
if errorlevel 6 goto 6
if errorlevel 5 goto 5
if errorlevel 4 goto 4
if errorlevel 3 goto 3
if errorlevel 2 goto 2
if errotlevel 1 goto 1
A simple example
@echo off
if "%1" == "/all" goto all
If exist c:\1.txt goto 1
echo The file 1.txt is not found
goto end
:1
echo The file 1.txt exists, press any key to read...
pause > nul
type 1.txt | more
goto end
:all
dir /s/w/p 1.txt
:: Display all 1.txt in the sub - directories of the C drive
:end
@echo off //Cancel the display of command operation on the screen
echo. |date| find "Current" //Only display the date
echo. |time| find "Current" //Only display the time
:: //Equivalent to rem
call //Call another batch file
del %0 //Self - delete
if "%1" == "string" goto //For example, if "%1" == "/p" goto p
if "%1" == "string" command //if "%1" == "/p" dir /w/p c:
if exist file command //Run the command if the file exists
copy /b //Merge files
fdisk /mbr //Uninstall the master boot record. If the master boot record is overwritten by LILO, it can be used to clear it
prompt $p$g //Restore the prompt
echo Free and Open > new DOS.txt //Write Free and Open into new DOS.txt
echo Happy New year >> new DOS.txt //Continue to write Happy New year into new DOS.txt
lh //Load the device into the upper memory. For example, lh smartdrv /x
mode 80 Restore the default display settings
mode mono Activate the monochrome display
mode con:cols=40-80 lines=25-50 //40-80;25-50 are parameters
Keyboard control
mode con:rate=32 delay=1 //Agile
mode con:rate=20 delay=4 //Accurate
mode con:rate=20 delay=2 //Default
Print control
mode com1:9600,8,N,1 //Fast
mode lpt1=com1
mode com1:2400,8,N,1 //Slow
mode lpt1=com1
echo Hello > prn //Test printing
Install CD - ROM
Add in config.sys
devicehigh=boot\CD-ROM.sys /d MSCD001
Add in autoexec.bat
path boot
mscdex /d MSCD001 /m 12
//CD-ROM.sys can be replaced by universal CD - ROM IDE.sys
//Menu display, selection
echo 1.
echo 2.
echo 3.
...
echo 9.
choice /c:123456789 /n Please choose:
if errorlevel 9 goto 9
if errorlevel 8 goto 8
if errorlevel 7 goto 7
if errorlevel 6 goto 6
if errorlevel 5 goto 5
if errorlevel 4 goto 4
if errorlevel 3 goto 3
if errorlevel 2 goto 2
if errotlevel 1 goto 1
A simple example
@echo off
if "%1" == "/all" goto all
If exist c:\1.txt goto 1
echo The file 1.txt is not found
goto end
:1
echo The file 1.txt exists, press any key to read...
pause > nul
type 1.txt | more
goto end
:all
dir /s/w/p 1.txt
:: Display all 1.txt in the sub - directories of the C drive
:end




