如何使用 findstr and/or for 循环到字符串中的 select 特定列

How can I use findstr and/or for loops to select particular columns within a string

我有一个包含以下行的文件 (directorylist.txt):

141228-0010

141231-0004

150102-0110

150106-0015

150107-0003

150201-0007

前 6 位数字是日期 (YYMMDD)

我需要一种方法来仅列出与月份列 MM 对应的变量匹配的行。例如.. 我有一个等于 01 的变量 %month%。我需要一个显示的文件:

150102-0110

150106-0015

150107-0003

我想使用 windows 批处理脚本来实现。有什么方法可以使用 findstr 或 for 循环吗?其他选项,如 powershell?

findstr /r /b "..%month%" directorylist.txt

如果没有您未透露的其他条件,应该适合您。