- @echo off
- setlocal EnableDelayedExpansion
-
- REM list the bin files
- :start
-
- dir /a-d /b .\bin\*.*>files.txt
- set /a flag=0
- for /f %%i in (files.txt) do (
- echo %%i
- set /a flag=flag+1
- set device!flag!=%%i
- )
- cls
- if !flag!==0 echo No files found. & pause & goto start
- if !flag! GTR 1 echo List the test files.
- set /a flag2=1
- for /f %%i in (files.txt) do (
- echo !flag2!. %%i
- set /a flag2=flag2+1
- )
- set /p num=Please select the files(ex:1,2,3):
-
- for /f "Delims=," %%a in ("%num%") do (
- echo %%a
-
- )
- pause
复制代码 这段代码是先列出目录中的文件列表,然后打印出来,根据打印的顺序,选择多个数字后,把选择的显示出来,可是我试了之后只能运行一次,不知为何,有大佬解救么?谢谢 |