I create an archive using the following command:

rar a -s -m5 -mc0:0t+ 1.rar arch 

This folder contains the file 1234.txt. I need to create a bat command in order to find out the size of the compressed file '1234.txt' in the archive '1.rar'.

Team

 rar v 1.rar 

Produces the following result: enter image description here

If you do a breakdown into tokens, then the first one should correspond to Pathname / Comment, and the third one should be Packed. But request

 for /f "tokens=1,3" %%x in ('rar v 1.rar') do if "%%y"=="1234.txt" echo %%x 

gives:

enter image description here

Maybe someone knows how to solve this problem?

  • The difference in archive sizes is not equal to the file size in the archive. Especially for merged archives ... - Akina
  • Use rar v archivename.rar | find "new_filename" rar v archivename.rar | find "new_filename" - Akina
  • I agree that the difference that is obtained with the last command is not equal to the file size in the archive. But if we look at the 'Archive Properties-> Archive', then there is information about the total size, the size in the archive, and the degree of compression. And here is the difference between the parameters of the two archives "size in the archive" and is equal to the size of the compressed file (tested on several archives). But what request to get this parameter I can’t find anywhere else - Sija
  • If we look at the 'Properties of the archive-> Archive', then there is information about the total size, the size in the archive and the degree of compression. Information about the archive and the files in it is given by the command v . See above. For more details, see rar /? . - Akina
  • I used this command, but there when adding | find "new_filename" simply displays the directory and file name. Or maybe you can tell me how, from the result that the rar v archivename.rar command gives, pull the value in the 'packed' column into a separate variable? - Sija

0