0
내 폴더가 "C : \ sample \"이라고 가정 해 봅시다. .dat 파일에는 두 가지 유형이 있습니다..dat 파일에서 단어 찾기 및 복사
하나는
Head #Index Name= "DbResultDataHeadStruct" TypeNo VarType = REG_DWORD 0x8 Data = "" TypeA VarType = REG_DWORD 0x8 Data = ""
다른 하나입니다 :
Head #Index Name= "DbResultDataHeadStruct" TypeNo VarType = REG_DWORD 0x8 Data = "" TypeB VarType = REG_DWORD 0x8 Data = ""
만 차이를 보듯이
는 TYPEA와 b를 입력합니다. .dat 파일에 TypeA가 "C : \ sample \ TypeA"이고 TypeB가 "C : \ sample \ TypeB"인 경우 파일 복사/잘라 내기를 원합니다. 이 배치 파일은 항상 새 파일을 기다립니다. 아래에서이 코드를 발견했지만 나에 따라 해결할 수 없습니다. 어쩌면 도움이 될지도 몰라.@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Define constants here:
set "PATTERN=*.dat"
set "SOURCE=C:\sample\"
set "TARGET=C:\sample\TypeA"
set "STRING1=TypeA"
set "STRING2=TypeB"
pushd "%SOURCE%" && (
for /F "delims=" %%F in ('findstr /S /M /I /R /C:"\<%STRING1%\>" "%PATTERN%"') do (
for /F "delims=" %%E in ('findstr /M /I /R /C:"\<%STRING2%\>" "%%F"') do (
ECHO copy "%%E" "%TARGET%\%%~nxE"
)
)
popd
)
endlocal
exit /B