0

I am working on a power shell script. I have a 7z file which has 2 files inside it. I want to unzip this 7z file in the same directory where the 7z file is and get the full names of the 2 files inside the 7z. I have to do all this using power shell.

Currently my script is:

set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
sz x -o$unZipFoldersPath $compressedfolder.FullName -r

I am getting the error

Cannot find archive

Is not the argument after -o is the output where we have to store our unzip file ?

Waleed Naveed
  • 2,293
  • 2
  • 29
  • 57

1 Answers1

0

That one seems to work:

set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"    
$Destination = 'C:\Temp\Destination'
$Source =  = 'C:\Temp\Source' #*.7z files inside

#-r parameter looks for all *.7z files
sz x -o"$($unZipFoldersPath)" "$($Source)" -r
Patrick
  • 2,128
  • 16
  • 24