Batch - findstr special characters

北城余情 提交于 2019-12-25 09:13:33

问题


I try to find and move all files with the character "{" (without the quotes) for example filename{{xyz}}.txt

My Code:

@echo OFF
setlocal enableextensions disabledelayedexpansion

set "source=C:\Users\OLD\*.txt"
set "target=C:\Users\NEW"
set "searchString=}"

set "found="
for /f "delims=" %%a in ('
    findstr /m /i /l /c:"%searchString%" "%source%" 2^>nul 
') do (
    if not defined found set "found=1"
    move "%%a" "%target%"
)

if not defined found (
    echo not found
)

This script found all characters, unfortunately not that one what I need {. So now I will ask here for help.

Best regs

来源:https://stackoverflow.com/questions/37911839/batch-findstr-special-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!