thepollock89
New Member
- Joined
- Apr 3, 2012
- Messages
- 5 (0.00/day)
The purpose of my code is basically to store contacts, view them, and search by name.
It all seems to work fine so far but I don't know how to go about making the batch search for a specific name at the start of each line of the batch file and delete the whole line.
I was thinking maybe I can make the output of the chosen line move to a temporary text file that gets deleted after a number is added or the list of numbers are viewed. The section of the code named "filtered" is the part where i was hoping to add this function if possible.
I already did Google searches but I was looking for a noob friendly answer.
If any can help I would greatly appreciate it.
It all seems to work fine so far but I don't know how to go about making the batch search for a specific name at the start of each line of the batch file and delete the whole line.
I was thinking maybe I can make the output of the chosen line move to a temporary text file that gets deleted after a number is added or the list of numbers are viewed. The section of the code named "filtered" is the part where i was hoping to add this function if possible.
I already did Google searches but I was looking for a noob friendly answer.
If any can help I would greatly appreciate it.
Code:
@echo off
cd %userprofile%
if exist contacts.txt goto start
else if not exist contacts.txt goto create
:start
cls
color 34
color 04
echo =================================================
echo v view contacts
echo a add contact
echo f use filter
echo e exit
echo =================================================
set /p var=view contacts, add one, or delete one?
if "%var%"=="v" goto list
if "%var%"=="a" goto add
if "%var%"=="f" goto filtered
if "%var%"=="e" exit
:list
cls
cd %userprofile%
type contacts.txt
echo =================================================
echo press any key to return to the main menu......
pause>nul
del unwanted.txt /q
goto start
:add
cls
echo =================================================
cd %userprofile%
set /p var2=enter a name:
set /p var3=enter first 3 digits:
set /p var4=enter second three digits:
set /p var5=enter last 4 digits:
echo =================================================
echo %var2% - %var3%-%var4%-%var5% >> contacts.txt
echo =================================================
echo press any key to return to the main menu.....
pause>nul
del unwanted.txt /q
goto start
:create
cd %userprofile%
contacts>contacts.txt>nul
goto start
:filtered
cls
set /p var6=type the name of the contact you want to delete:
Last edited: