ieutk 当前离线
荣誉版主
@echo off&setlocal enabledelayedexpansion:maincls&echo.set input=set /p input= 请输入字母: if not defined input goto mainecho %input%|findstr "^[a-z]*$">nul||goto maincall :ya %input% lenfor /l %%a in (0 1 %len%) do call :ie %%a _numecho.echo 你输入了 "%input%" ,它们的总和为 "%_num%"echo.pauseset _num=0goto main :yafor /f "tokens=1 delims=:" %%a in ('^(echo %1^&echo.^)^|findstr /o ".*"') do set /a %2=%%a-4goto :eof:: 在随风发的贴子中看到此方法,现学现用,拿来试下 :iefor %%b in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do ( set /a num+=1 if "!input:~%1,1!"=="%%b" set /a %2+=!num! )set num=0goto :eofCOPY
TOP