[cmd] Unzip files (7-zip) via cmd command

I try to unzip a file via CMD.

So I install WinZip (and its plugin to cmd), WinRAR, and 7-zip.

But when I try to execute a command via the CMD:

7z e myzip.zip

It gives the next error:

7z is not recognized as an internal or external command

In addition, I added the folder of 7-z to the environment variables (Properties--> advanced --> Environment Variables --> user variable --> choose path, and add C:\Program Files\7-Zip

What can be the reason?

I find the below solution for this.

while zipping in cmd or git bash - getting error like

 7z:command not found 

solution:

  • install 7z in your machine
  • set the path in Environment Variables -> User Variables
    • path -> edit -> new (add the path - C:\ProgramFiles\7-Zip) -> OK

Now to use 7z in git bash -

  • Go to C:\Program Files\7-Zip and copy 7z.exe file
  • Go to C:\Program Files\Git\usr\bin and paste 7z.exe file

Now, you will be able to use 7z with Git Bash

This question is related to cmd 7zip winzip

The answer is


Regarding Phil Street's post:

It may actually be installed in your 32-bit program folder instead of your default x64, if you're running 64-bit OS. Check to see where 7-zip is installed, and if it is in Program Files (x86) then try using this instead:

PATH=%PATH%;C:\Program Files (x86)\7-Zip

make sure that your path is pointing to .exe file in C:\Program Files\7-Zip (may in bin directory)


In Windows 10 I had to run the batch file as an administrator.