Below is the code i have written for finding 'error' string in particular file and copying result into seperate file.
set today=%date:~-4,4%-%date:~-10,2%-%date:~-7,2%
set day=-1
echo >"%temp%\%~n0.vbs" s=DateAdd("d",%day%,now) : d=weekday(s)
echo>>"%temp%\%~n0.vbs" WScript.Echo year(s)^& right(100+month(s),2)^& right(100+day(s),2)
for /f %%a in ('cscript /nologo "%temp%\%~n0.vbs"') do set "result=%%a"
del "%temp%\%~n0.vbs"
set "YYYY=%result:~0,4%"
set "MM=%result:~4,2%"
set "DD=%result:~6,2%"
set "yesterday=%yyyy%-%mm%-%dd%"
findstr /C:"error" "\\abcd023\peak$\Monitor_5.7\logs\monitor-%today%-0.log" >> C:\a\xyz.txt
findstr /C:"error" "\\abcd023\peak$\Monitor_5.7\logs\k-server-%yesterday%-0.log.zip\k-server-%yesterday%-0.log" >> C:\a\xyz.txt
k-server-%yesterday%-0.log.zip\ :- as this is the zip file it's giving me error as cannot find the path. For the similar path without zip folder its giving me result.
I want to scan the file which is present in the zip folder without unzipping that folder.