我正在尝试使用用户输入的新工资替换存储在文本文件中的旧工资。
我正在使用的文本文件(employees.txt)如下所示:101,Elon,Muskrat,46,1100000000
我尝试过与this类似的操作,但它无效。
任何人都可以向我解释我缺少什么吗?
:start
echo ------------- MAIN MENU -------------
echo 1. Search by Employee ID
echo 2. Exit
set /p choice=Please select a number:
if %choice%==1 GOTO :employeeid
if %choice%==2 GOTO :exit
cls
echo INVALID INPUT!
echo Please select a number listed in the Menu options.
pause
cls
GOTO :start
:employeeid
cls
echo =========== Employee Pay Raise ===========
set /p id=Enter Employee ID:
set /p pay=Enter the New Salary:
set count=0
for /f "tokens=1-5 delims=," %%e in (Company\employees.txt) do (
if %%a==%id% (
%%a %%b %%c %%d %pay% > Company\employees.txt
)
)
set count=1
if %count%==0 echo Record Not Found! Please create the employee record
first.
pause
cls
GOTO :start
:exit
GOTO :eof