I need some help with batch scripting. I am using 7zip command line to send the output of each rar file (jpg files) to a text file "contents.txt"
set PATH=%PATH%;"C:\Program Files\7-Zip"
echo. > contents.txt
for /R %%f in ("*.*") do (
7z l -r "%%f" | FIND /V "ing " | FIND /V "Igor Pavlov" | FIND /V "--" | FIND /V "Path" | FIND /V "Type" | FIND /V "Solid" | FIND /V "Blocks" | FIND /V "Multivolume" | FIND /V "Volumes" | FIND /V "Date" | FIND /V "---" | FIND /V "Physical Size" | FINDSTR /R /E ".jpg" >> contents.txt
)
PAUSE
The output of contents.txt is :
2001-07-17 08:39:00 ....A 326196 326164 A01.jpg
2001-07-17 08:39:00 ....A 338338 338338 A02.jpg
2001-07-17 08:39:00 ....A 332076 332076 A03.jpg
2001-07-17 08:39:00 ....A 458422 458422 A04.jpg
2001-07-17 08:39:00 ....A 376821 376821 A05.jpg
2001-07-17 08:39:00 ....A 326196 326164 B01.jpg
2001-07-17 08:39:00 ....A 338338 338338 B02.jpg
2001-07-17 08:39:00 ....A 332076 332076 B03.jpg
2001-07-17 08:39:00 ....A 458422 458422 B04.jpg
2001-07-17 08:39:00 ....A 376821 376821 B05.jpg
2001-07-17 08:39:00 ....A 326196 326164 C01.jpg
2001-07-17 08:39:00 ....A 338338 338338 C02.jpg
2001-07-17 08:39:00 ....A 332076 332076 C03.jpg
2001-07-17 08:39:00 ....A 458422 458422 C04.jpg
2001-07-17 08:39:00 ....A 376821 376821 C05.jpg
The A*.jpg fies from aa.rar, the B*.jpg files are from bb.rar, and vice versa. I am trying to read the contents.txt file to get the first file name only. I modified the above script to:
for /R %%f in ("*.*") do (
7z l -r "%%f" | FIND /V "ing " | FIND /V "Igor Pavlov" | FIND /V "--" | FIND /V "Path" | FIND /V "Type" | FIND /V "Solid" | FIND /V "Blocks" | FIND /V "Multivolume" | FIND /V "Volumes" | FIND /V "Date" | FIND /V "---" | FIND /V "Physical Size" | FINDSTR /R /E ".jpg" >> contents.txt
for /f "usebackq delims=" %%i in (contents.txt) do (
set test="%%i"
echo %test%
)
)
PAUSE
but it does not work. Can anyone help me what am I doing wrong here? The echo %test% output "test", not the contents of text. I am new to batch script programming, so please excuse my stupidity. I want the following output:
aa.rar A01.jpg
bb.rar B01.jpg
cc.rar C01.jpg