5

I need to use gunzip (which is the decompression tool of gzip) in a terminal on Windows

I've downloaded gzip from here (first download link)

I installed it and added its /bin folder to my PATH variable, the gzip command works but gunzip is not even executable so I can't use it

gunzip content:

#!/bin/sh
PATH=${GZIP_BINDIR-'c:/progra~1/Gzip/bin'}:$PATH
exec gzip -d "$@"

Thanks

Valentin Macé
  • 1,150
  • 1
  • 10
  • 25

3 Answers3

5

I made it work

As I said I needed to install gzip and add its /bin folder to my PATH variable

Then edit the ProgramFiles/GnuWin32/bin/gunzip file using this (replace everything):

@echo off
gzip -d %1

and save it to .bat format so you now have a gunzip.bat file in your /bin folder

Now I can use gunzip in a terminal :)

Valentin Macé
  • 1,150
  • 1
  • 10
  • 25
  • 2
    Be careful in case you are passing more than one argument this will not work by using %1 instead of %* only the first argument is taken into consideration. – A. Lion Aug 18 '18 at 05:48
3

I have been using MobaXterm software in my local machine (Windows).
It works like Putty and WinSCP together and opens the local desktop in linux mode, thus it is easy for me to gunzip the *.gz type files.

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68
  • I liked this solution. The terminal in MobaXterm has gunzip available. I had some trouble finding the Windows file system, but i found the drives under /media so I was able to navigate to /media/c/Users/myuser/Downloads and use gunzip on my downloaded file. – datagutten Sep 29 '22 at 12:53
1

The code you posted is bash, suitable for linux. You need to make a dos/command version of it to be run on windows i.e.

REM THIS IS CMD
PATH=c:/progra~1/Gzip/bin;%PATH%
gzip.exe -d "%*"

Since it is a different build anyway it is hard to say if all command line parameters are the same you are used with linux so maybe even with this .cmd or .bat you will not be able to work at the same way you do in a linux environment.

A. Lion
  • 673
  • 5
  • 12