unzip a file one folder up in a directory tree


I’m having issue with the unzipping a file in a directory tree.

Example scenario:


but in my scenario, I want to unzip my files in Project sub-folder

Please let me know if it is possible in Powershell script, any line of code or a example will be helpful.



How are you trying to do it ? You can use Expand-Archive cmdlet (V 5 onwards) to unzip and use the -DestinationPath to your desired path.

You can also use the CLI version of 7zip.

Some code I use for unpacking:

foreach ($arg in $args) {

$file = Get-Item $arg
& "C:\Program Files\7-Zip\7z.exe" x "$arg" -o"$($file.DirectoryName)"
if ($LastExitCode -gt 0) {
Write-Host "`nError: Exit code $LastExitCode`n" -ForegroundColor Red

This is kind of invoking expression, but if you are looking for PowerShell to get this job done, then as @kvprasoon mentioned you need to use Expand-Archive cmdlet.

Thank you.

Thanks for the replies

my issue is resolved