Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 回显子文件夹中包含参数的所有文件_Batch File - Fatal编程技术网

Batch file 回显子文件夹中包含参数的所有文件

Batch file 回显子文件夹中包含参数的所有文件,batch-file,Batch File,刚开始学习批处理文件,在搜索一些帮助 我有一个文件夹目录,其中包含许多.exe文件。某些子文件夹包含多个.exe文件以及其他文件,如下所示: Folder 1 file.exe file.conf file.exe Folder 2 file.exe Folder 3 file.txt file.exe Folder 4 file.exe 但是,在某些文件夹中,我有多个.exe文件,我只想列出setup.exe文件: Folder 5

刚开始学习批处理文件,在搜索一些帮助

我有一个文件夹目录,其中包含许多.exe文件。某些子文件夹包含多个.exe文件以及其他文件,如下所示:

Folder 1
    file.exe
    file.conf
    file.exe
Folder 2
    file.exe
Folder 3
    file.txt
    file.exe
Folder 4
    file.exe
但是,在某些文件夹中,我有多个.exe文件,我只想列出
setup.exe
文件:

Folder 5
    file.exe
    setup.exe
    file2.exe
我可以使用列出文件夹和子文件夹中的所有.exe文件

for/r%%i in(*.exe*)do echo%%~nxi

显示所有文件的文件名和扩展名

但是,如果.exe文件包含值(例如,如果文件名包含单词
setup
),是否可以列出这些文件


谢谢

所以,我在发布问题一分钟后就找到了答案

我想找到所有包含单词
setup
的.exe文件


for/r%%i in(*setup*.exe)do echo%%~nxi

在我发布了这个问题后,我发现了这一点--1。你的问题中没有提到
T
C
,因此答案的相关部分不合适;2.您的筛选器
*TC*.exe
将查找包含
TC
TC
TC
TC
.exe
文件;例如,它不会找到包含
ToC
的文件,也不会找到
CT
;3.
*setup.exe*
会找到像
setup.exe
ABCsetup.executable
,…,但找不到
setupABC.exe
;既然您在问题中说»如果文件名包含单词
setup
«,则回显该文件名,那么正确的过滤器应该类似于
*setup*.exe
;抱歉,我一直在处理这个文件,所以我有多余的东西在里面,我没有意识到,我已经编辑了我的答案,使它适合这个问题:)