I have a .tar.gz
file that I need to extract. I've handled the gunzip bit with the GzipStream
object from System.IO.Compression
, but I couldn't find anything for dealing with tarballs in that namespace. Is there a way to deal with .tar
files natively in Powershell? Note that it's only important that I be able to call any such function/method/object construction/system binary from a Powershell script; it doesn't need to actually be written in powershell. (If it matters I'm using 64-bit windows 10)
P.S. please don't say "use 7zip"; that's not native
In Windows 10, you can install 7zip support from within PowerShell directly with Install-Package 7Zip4Powershell . The Expand-7zip cmdlet will extract multiple archive formats, including tar.
Simply right-click the item you want to compress, mouseover compress, and choose tar. gz. You can also right-click a tar. gz file, mouseover extract, and select an option to unpack the archive.
Since TAR files are simply archives, they need to be compressed by another utility, such as gzip, to reduce their size. The TAR format is often used for open source software distribution. Tar unzip software like WinZip is needed to unpack a tar file.
I believe tar
has been added as a native function in Windows 10 since the posting of this.
From the command prompt or PowerShell in Windows 10 I can run
tar -xvzf .\whatever.tar.gz
Note that the .\
was added after auto-completing by the use of tab
in PowerShell, but I think it should work without that.
There may be some underlying differences between this function and its Unix implementation (since it is on Windows after all), but it worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With