简体   繁体   English

在命令行中在 Windows 上使用 gunzip

[英]Using gunzip on Windows in command line

I need to use gunzip (which is the decompression tool of gzip) in a terminal on Windows我需要在 Windows 的终端中使用 gunzip(这是 gzip 的解压工具)

I've downloaded gzip from here (first download link)我已经从这里下载了 gzip(第一个下载链接)

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我安装了它并将其/bin文件夹添加到我的PATH变量中, gzip命令有效,但 gunzip 甚至无法执行,所以我无法使用它

gunzip content: gunzip 内容:

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

Thanks谢谢

I made it work我让它工作

As I said I needed to install gzip and add its /bin folder to my PATH variable正如我所说,我需要安装 gzip 并将其 /bin 文件夹添加到我的 PATH 变量中

Then edit the ProgramFiles/GnuWin32/bin/gunzip file using this (replace everything):然后使用此编辑ProgramFiles/GnuWin32/bin/gunzip文件(替换所有内容):

@echo off
gzip -d %1

and save it to .bat format so you now have a gunzip.bat file in your /bin folder并将其保存为 .bat 格式,以便您现在在 /bin 文件夹中有一个gunzip.bat文件

Now I can use gunzip in a terminal :)现在我可以在终端中使用 gunzip :)

I have been using MobaXterm software in my local machine (Windows).我一直在我的本地机器 (Windows) 上使用MobaXterm软件。
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.它像PuttyWinSCP一样工作,并以 linux 模式打开本地桌面,因此我很容易对*.gz类型的文件进行 gunzip。

The code you posted is bash, suitable for linux.您发布的代码是bash,适用于linux。 You need to make a dos/command version of it to be run on windows ie您需要制作它的 dos/command 版本才能在 Windows 上运行,即

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.由于无论如何它是一个不同的构建,因此很难说所有命令行参数是否与您在 linux 中使用的相同,因此即使使用此 .cmd 或 .bat,您也无法以相同的方式工作linux环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM