简体   繁体   English

批量读取文本文件,并能够将其用作有效输入

[英]Batch Reading text file, and being able to use it as valid input

i'm currently creating a batch file that has to tell which files the desired folder contains, and being able to promt those file names. 我当前正在创建一个批处理文件,该批处理文件必须告诉您所需文件夹包含哪些文件,并能够提示这些文件名。 From there i want an input field where you enter the name of the file, which will in that case, open the file. 从那里我想要一个输入字段,您可以在其中输入文件名,在这种情况下,将打开文件。

I really someone would be able to help me, this is my current code for this part 我确实有人可以为您提供帮助,这是这部分的当前代码

    :dan
cls
echo Finding files in danish
echo.
dir C:\Users\Anton\Desktop\Skoe\dansk\ /b > files.txt %fi%
dir C:\Users\Anton\Desktop\Skoe\dansk\ /b %fi%
echo.
echo.
echo.
echo.
set /p sr=Which file do you wish to start?
// this is where i need the code to check if the user entered a file name that is in that // folder, and if it is a valid file, send the user to :filestart where hes file will be //started
pause
:filestart
echo filstart
// here i need the desired file started
@echo off
cls
echo Finding files in danish
echo.
dir C:\Users\Anton\Desktop\Skoe\dansk\ /b > files.txt %fi%
dir C:\Users\Anton\Desktop\Skoe\dansk\ /b %fi%
echo.
echo.
:readFileName
echo.
echo.
set /p sr=Which file do you wish to start? 
IF EXIST dansk\%sr% (
goto filestart
) else (
echo %sr% does not exist.
echo Please try again.
goto readFileName
)
pause
:filestart
echo filestart %sr%
start dansk\%sr%

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM