Board logo

标题: [文件操作] [已解决]批处理命令dir如何精确匹配扩展名? [打印本页]

作者: haiblue    时间: 2012-7-11 14:13     标题: [已解决]批处理命令dir如何精确匹配扩展名?

dir *.txt 列出当前目录中所有具有以 .txt 开头(如 .txt、.txt1、.txt_old)的扩展名的文件。
现在我只需要.txt一种扩展名的文件
有简单达成的方法吗?
作者: canyuexiaolang    时间: 2012-7-11 14:26

  1. dir /a-d /b *.txt | findstr .txt$
复制代码

作者: haiblue    时间: 2012-7-11 14:41

回复 2# canyuexiaolang


    非常感谢~~完全OK~~




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