本帖最后由 tmplinshi 于 2011-7-29 17:22 编辑
- @echo off
- setlocal enabledelayedexpansion
-
- set file="list.txt"
-
- set n=
- set menu1=
-
- :: ---------------------------
- set \n=^
-
-
- :: ---------------------------
-
- for /f "usebackq tokens=2,3 delims=#." %%a in (%file%) do (
- if not defined #%%a (
- set /a n += 1
- set menu1=!menu1!!n! %%a!\n!
- set name!n!=%%a
- set #%%a=#
- )
- if not defined #%%a.%%b (
- set #%%a.%%b=#
- )
- )
-
- :menu1
- cls
- echo !menu1!
- set input1=
- set /p input1=请选择:
-
- if not defined input1 goto menu1
- if !input1! gtr %n% goto menu1
- if !input1! lss 0 goto menu1
-
- :menu2
- cls
- for /f "skip=1 tokens=2 delims=.=" %%a in (' set #!name%input1%! ') do echo %%a
- echo,
- set input2=
- set /p input2=请选择:
-
- if not defined input2 goto menu2
-
- cls
- findstr "#!name%input1%!.%input2%楼" %file%
- echo,
-
- pause
- goto menu1
复制代码
|