You need to use the var > file
to print out the echo
result.
Or, double to add
(whitout replace) at the end of the file.
Now, using tokens
& delims
you actually can "split" each line, and see if match your condition with findstr
.
So for example:
@echo off
for /f "tokens=1,3 delims= " %%g in ('7z.exe l -slt %file%') do (
echo.%%g | findstr /b /c:"Path" 1>nul
if NOT errorlevel 1 (
echo.%%h >> list.txt
)
)
l -slt
Tell 7z to display "Show technical information"tokens=1,3
Token 1 and 3 catch the first and thirddelims=
Delims by "space" is what we going to use herefindstr /b
Find "Path" at the very start (/b) of "g" (first token)/c:Path
We look for "Path" in the first token, because is how start the line that contain the filename in 7z list.errorlevel
Is 1 when the string is not found, so...var >> file.txt
Print out to "list.txt", but only the filename (second token)%%h
Note we set a correlative letter for the second token, if start with g, then the next one is h
Now, you will have to handeld with posible special chars in filenames, spaces or whatever you want to filter out.
More info:
Hope it's helps.