-1

I am trying to extract a zip file in Windows 10 using a batch script. It a simple command:

 tar zxf "logstash-5.4.0.tar.gz"
 ECHO "installed" 

But I am getting following error:

'tar' is not recognized as an internal or external command

I have seen that I have to install the tar but how can I do that?

How can I do this?

EDIT Tar is pre installed in windows or we have to externally add it? Still how can i extract without using third party tool.

Mishi
  • 628
  • 4
  • 16
  • 40
  • 2
    So you don't want to use a third-party `unzip` program, but you're willing to use a third-party `tar` program? That doesn't really make much sense. – Some programmer dude Aug 21 '17 at 09:31
  • Nope, `tar` has never been a standard tool in Windows. It is on Unix and Unix-like systems though. – Some programmer dude Aug 21 '17 at 09:34
  • 1
    [What is the reason for '...' is not recognized as an internal or external command, operable program or batch file?](https://stackoverflow.com/a/41461002/3074564) Well, in real you want to extract a GZ archive file which inside contains a TAR archive file. So you need to run in real a double extraction process. Windows has no built-in support for GZ and TAR archives. You need third-party tools like 7-Zip or WinRAR (or Total Commander with additional GZ and TAR packer plugins) to extract such Unix archives on Windows. – Mofi Aug 21 '17 at 09:41
  • 3
    7-Zip is installed with a manual. Double click on file __7zip.chm__ to open this help file (manual) containing all information about how to use 7-Zip from command line with appropriate command for creation of archive files or extracting files from inside an archive file with appropriate options. A ZIP file can be opened in Windows Explorer like a directory. Just double click on the file. From command line without usage of third-party tools see [How can I compress and uncompress files and folders with batch file without using any external tools?](https://stackoverflow.com/questions/28043589/) – Mofi Aug 21 '17 at 09:47

2 Answers2

7

You can download Tartool Application in your desktop and paste it into C:\Windows\system32\

For eg:-(C:\Windows\system32\tartool.exe)

By doing this it work as internal command when you want to extract your file you can simply use

C:>TarTool.exe D:\sample.tar.gz ./

For more commands you can read documention part of that Tool

  • then following command worked to extract tar content from the .tgz: TarTool.exe "D:\Directory Name\archive.tgz" C:\ (quotation marks because the space in the path. It not accepted parameters like -xzf. Note that the tool require also some other file that is in the archive to be in System32) – 16851556 Jul 17 '20 at 19:34
0

Starting windows 10 build 17063, TAR is an inbuilt tool and no need to install it separately. MSDN link

For example, to uninstall a file named XYZ.zip you can execute the following in Command Prompt.

tar -xvf XYZ.zip
TechNerd
  • 91
  • 5