How To

How to unzip a GZ file in Windows 10 [Quick Guide]

WinZip

WinZip

Any type of compressed file format that you are dealing with can be easily opened with WinZip. Take advantage of teh offer now!

 

2. How can I unzip a GZ file using a Command-Line?

  1. Press Start
  2. Type in cmd, and open the Command Prompt with Administrator rights
  3. Type in the following command, and then press Enter to initialize it:

tar -xvzf C:PATHTOFILEFILE-NAME.tar.gz -C C:PATHTOFOLDEREXTRACTION


3. How can I unzip GZ files with Powershell?

  1. Press Start
  2. Type in powershell and launch PowerShell with Administrative privileges
  3. Type in the following command and press Enter to apply it:
function unzip($path,$to) {
    $7z = "$env:TEMP7z"
    if (!(test-path $7z) -or !(test-path "$7z7za.exe")) { 
        if (!(test-path $7z)) { md $7z | out-null }
        push-location $7z
        try {
            write-host "Downloading 7zip" -foregroundcolor cyan
            $wc = new-object system.net.webClient
            $wc.headers.add('user-agent', [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox)
            $wc.downloadFile("http://softlayer-dal.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7za920.zip","$7z7z.zip")
            write-host "done." foregroundcolor green

            add-type -assembly "system.io.compression.filesystem"
            [io.compression.zipfile]::extracttodirectory("$7z7z.zip","$7z")
            del .7z.zip
        }
        finally { pop-location }
    }

    if ($path.endswith('.tar.gz') -or $path.endswith('.tgz')) {
        # This is some crazy s**t right here
        $x = "cmd"
        $y = "/C `"^`"$7z7za.exe^`" x ^`"$path^`" -so | ^`"$7z7za.exe^`" x -y -si -ttar -o^`"$to^`""
        & $x $y
    } else {
        & "$7z7za.exe" x $path -y -o"$to"
    }
}

By following these steps, you should now be able to extract GZ files in whatever manner you find useful.

Let us know which of the methods described above was more useful to you, by leaving your feedback in the comments section below.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button