【发布时间】:2020-12-06 18:34:59
【问题描述】:
我查看的所有脚本都是相同的,它们列出文件夹中的文件并要求我选择。当我按下例如“3”时,什么也没有发生。我想批量列出文件夹中的文件,然后要求我选择一个,最重要的部分:打开我选择的文件
@echo off
setlocal enabledelayedexpansion
set count=0
set "choice_options="
for /F "delims=" %%A in ('dir /a:-d /b C:\image\Aselsan\') do (
REM Increment %count% here so that it doesn't get incremented later
set /a count+=1
REM Add the file name to the options array
set "options[!count!]=%%A"
REM Add the new option to the list of existing options
set choice_options=!choice_options!!count!
)
for /L %%A in (1,1,!count!) do echo [%%A]. !options[%%A]!
choice /c:!choice_options! /n /m "Enter a file to load: "
cmd /k
请帮我打开那个文本文件,我卡住了。。谢谢大家的帮助
【问题讨论】:
-
您需要在做出选择时为其添加一些内容!我建议你把它放在
20和22之间的某个地方
标签: list batch-file cmd choice