This picture is interesting, haha~:)
Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
@echo off
title Address Book
mode con cols=80 lines=25
set DisPlay=
setlocal EnableDelayedExpansion
:Main
cls
echo.
echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
echo ※ ※
echo ※ ☆Welcome to use the command prompt version address book☆ ※
echo ※ ※
echo ※ zxcv@bbs.cn-dos.net zh159@bbs.blueshow.net ※
echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※
echo.
echo ※ Add (N) ※ Delete (D) ※ Modify (M) ※ View all (A) ※ View Tel.db (V) ※
echo.
set input=
set line=
set /p input= Choose (directly enter contact or phone number to query)%DisPlay%:
if not exist Tel.db call :Tel.db
if "%input%" == "" set DisPlay=&goto Main
if /i "%input%" == "n" goto New
if /i "%input%" == "d" goto Del
if /i "%input%" == "m" goto Modify
if /i "%input%" == "a" goto All
if /i "%input%" == "v" goto db
for /f "tokens=1,2,3* delims=:" %%i in ('findstr /nirc:"%input%" Tel.db') do (
if "%%j" == "%input%" set line=%%i
if "%%k" == "%input%" set line=%%i)
if not "%line%" == "" (goto Display) else (
echo __________________________________________________
echo.
echo No record found for %input%
echo __________________________________________________
echo.
pause
set DisPlay=
goto Main)
:Display
echo __________________________________________________
echo.
for /f "skip=%line% delims=" %%i in (Tel.db) do (
if "%%i" == "-End-" goto End
echo %%i
)
:End
echo __________________________________________________
echo.
pause
set DisPlay=
goto Main
:Tel.db
>Tel.db echo ::Address book database
>>Tel.db echo --------------------------------------------------
>>Tel.db echo.
goto :eof
:New
set YN=Y
set check=
echo (Press Enter directly to cancel and return to the main interface)
call :Input
if "%check%" == "Y" set DisPlay=&echo Contact %input% already exists!&echo.&Pause&goto Main
if "%联系人姓名%" == "" set DisPlay=&goto Main
call :Newdb
set DisPlay=(Add new contact: %联系人姓名%)
goto Main
:Del
set YN=N
set check=
echo (Press Enter directly to cancel and return to the main interface)
echo.
set /p 删除联系人= Delete contact:
if "%删除联系人%" == "" set DisPlay=&goto Main
set input=%删除联系人%
call :Check
if "%check%" == "N" set DisPlay=&echo Contact %input% does not exist!&echo.&pause&goto Main
call :Deldb
set DisPlay=(Contact %删除联系人% has been deleted)
goto Main
:Modify
set YN=N
set check=
echo (Press Enter directly to cancel and return to the main interface)
echo.
set 修改联系人姓名=
set /p 删除联系人= Modify contact name:
set input=%删除联系人%
call :Check
if "%check%" == "N" set DisPlay=&echo Contact %input% does not exist!&echo.&pause&goto Main
if "%删除联系人%" == "" set DisPlay=&goto Main
echo Modify to:
call :Input
if "%联系人姓名%" == "" set DisPlay=&goto Main
call :Deldb
call :Newdb
set DisPlay=(Contact %删除联系人% has been modified)
goto Main
:All
cls
echo.
echo All contacts in the address book:
echo.
set N=
for /f "skip=3 delims=" %%i in (Tel.db) do (
set All=%%i
if "!All:~-2!" == "::" set /a N+=1&set AllShow=!All:::=!&&echo !AllShow::= Phone: !
set /a Page=!N!%%19
if "!Page!" == "0" if "!All:~-2!" == "::" call :AllPaus)
echo.
pause
goto Main
:db
start notepad Tel.db
goto Main
:Input
echo.
set 联系人姓名=
set 联系人电话=
set 联系人单位=
set 联系人地址=
set /p 联系人姓名= Contact name:
if "%联系人姓名%" == "" goto :eof
set input=%联系人姓名%
call :Check
if "%check%" == "%YN%" goto :eof
set /p 联系人电话= Contact phone number:
set /p 联系人地址= Contact unit:
set /p 联系人单位= Contact address:
goto :eof
:Newdb
>>Tel.db echo %联系人姓名%:%联系人电话%::
>>Tel.db echo Contact name: %联系人姓名%
>>Tel.db echo Contact phone number: %联系人电话%
if not "%联系人单位%" == "" >>Tel.db echo Contact unit: %联系人单位%
if not "%联系人地址%" == "" >>Tel.db echo Contact address: %联系人地址%
>>Tel.db echo -End-
>>Tel.db echo.
goto :eof
:Deldb
move/y Tel.db TelBak.db
call :Tel.db
set Delete=echo
for /f "skip=3 delims=" %%i in (TelBak.db) do (
for /f "tokens=1* delims=:" %%n in ("%%i") do (
if "%%n" == "%删除联系人%" set Delete=rem
>>Tel.db !Delete! %%i
if "%%i" == "-End-" >>Tel.db !Delete!.&&set Delete=echo
))
goto :eof
:AllPaus
echo.
set Paus=
set /p Paus= Press Enter to continue to the next page (B returns to the main interface)...
if /i "%Paus%" == "b" goto Main
cls
echo.
echo All contacts in the address book:
echo.
goto :eof
:Check
for /f "tokens=1,2,3* delims=:" %%i in ('findstr /nirc:"%input%" Tel.db') do (
if "%%j" == "%input%" set line=%%i
if "%%k" == "%input%" set line=%%i)
if not "%line%" == "" (goto CheckDisplay) else (
echo.
set check=N
goto :eof)
:CheckDisplay
echo __________________________________________________
echo.
for /f "skip=%line% delims=" %%i in (Tel.db) do (
if "%%i" == "-End-" goto CheckEnd
echo %%i
)
:CheckEnd
echo __________________________________________________
echo.
set check=Y
goto :eof| Rater | Score | Time |
|---|---|---|
| redtek | +3 | 2006-11-21 23:02 |