1

For example, I have file demo.cab. I want to know size of all files(extracted!) inside demo.cab. I don't want to extract files from it.

How can I do this using Windows PowerShell?

Thanks for help!

1 Answers1

1

You will have to use the cabarc.exe tool. Use the l parameter to list the content of the cabinet file. As it outputs some unwated text we have skip the first 9 lines. Then we replace "more than one space" to a space and so create a csv file. Finaly we call measure-content to get the sum of the files size :

cabarc.exe l .\hpchl118.cab > c:\temp\cab.txt
((gc C:\temp\cab.txt |skip -First 9) -replace '\s+',' ' | `
convertfrom-csv -delimiter " " -Header "file","size","date" | `
measure -property size -Sum | select  -expand sum)/1MB       
Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103