우리는 이것이 잘 작동하고 잘게 부딪쳐서 작동한다는 것을 알고 있습니다 ... Ref. .. fileone 및 filetwo을이 배치 스크립트에 지금 다른 FORFILES로하고 두 배로 %% G로 전화를 걸려면 내 생각 것 : Using forfiles with multiple file types for search mask?FORFILES를 여러 번 사용합니다.
for %G in (fileone, filetwo) do forfiles /P D:\hold\logs /M *.%G.* /C "cmd /c echo @path"
우리가 원하는 것은이 두 파일 마스크를 사용하는 것입니다 한 번에 두 가지 작업을 모두 수행 할 수 있습니까?
SET SOMELOGS=D:\hold\logs
for %%G in (fileone, filetwo) do forfiles /P %SOMELOGS% /M *.%%G.* /C "cmd /c ECHO @path & call :locate @path"
:locate
echo somepath %%1
FOR /f "tokens=1-9 delims=/: " %aa IN ('forfiles /P "%SOMELOGS%" /M %%1 /D -1 /C "cmd /c echo @file @fdate @ftime"') DO call :ZIP %%a %%b %%c %%d %%e %%f %%g
:ZIP
PAUSE
결과는 다음과 같습니다
"D:\hold\logs\server.fileone.log.2013-12-14.a"
Invalid attempt to call batch label outside of batch script.
"D:\hold\logs\server.fileone.log.2013-12-15.a"
Invalid attempt to call batch label outside of batch script.
"D:\hold\logs\server.fileone.log.2013-12-15.b"
Invalid attempt to call batch label outside of batch script.
"D:\hold\logs\server.fileone.log.2013-12-16.a"
Invalid attempt to call batch label outside of batch script.
이는 사용할 수 없습니다 .. 중 하나가 작동하지 않는 것 :/c를 한 번 이상 ... 참조를 .. nested forfiles: path and extension filter
SET SOMELOGS=D:\hold\logs
for %%G in (fileone, filetwo) do forfiles /p %SOMELOGS% /m *.%%G.* "forfiles /p @path /M %%1 /D -1 /C "cmd /c echo @file @fdate @ftime"') DO call :ZIP %%a %%b %%c %%d %%e %%f %%g
:ZIP
PAUSE
루프 매개 변수에 _two_ 퍼센트 기호'%% a' ('% aa'이 아님)가 필요합니다. – Endoro
OK .. 스크립트에서 %%를 업데이트했습니다. 그것을 잡아 주셔서 감사합니다. 그래도 작동이 안되는. – Leptonator