Board logo

标题: [文件操作] [已解决]批处理命令dir搜索文件出现问题 [打印本页]

作者: happyxxdhaha    时间: 2019-2-24 21:55     标题: [已解决]批处理命令dir搜索文件出现问题

在命令行输入如下代码:dir /a-d /s /b *.cpp,预期的输出结果应该是所有的cpp为扩展名的文件,输出结果却不符合预期,以下为输出结果,只有第一行是我想要的,后面四行为什么也输出来了?
  1. C:\test\a.cpp
  2. C:\test\a.cppppp
  3. C:\test\a.cppp
  4. C:\test\a.cpppp
  5. C:\test\a.cpppppp
复制代码

作者: ivor    时间: 2019-2-24 22:27

换种方式吧,cmd就这样
  1. dir /a-d /s /b *.cpp | findstr  .cpp$
复制代码

作者: Batcher    时间: 2019-2-25 09:44

我的Win10没有这个问题




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2