Why doesn't Windows have a command-line zip command?
Why is there no command-line hook for this, like there is on Linux?
There actually is a PowerShell command you can use. You would simply do the following command to compress a file.
Compress-Archive -LiteralPath 'C:\Users\User\Desktop\Example\Test FIle.txt' -DestinationPath "C:\Users\User\Desktop\Example\Test.zip"
You would simply do the following command to uncompress that same archive.
Expand-Archive -LiteralPath "C:\Users\User\Desktop\Example\Test.Zip" -DestinationPath "C:\Users\User\Desktop\Example" -Force
Sources:
(I am aware of 3rd party tools, I am not interested in them
PowerShell is built into all modern versions of Windows. In this case the commands I am suggesting require PowerShell 5.0+
Related videos on Youtube
cowlinator
Why do so many popular answers on Stack Overflow consist of nothing other than some form of the question "why would you want to do that?"
Updated on September 18, 2022Comments
-
cowlinator over 1 year
Windows has a built-in "zip" program for archiving and un-archiving files. It comes with every installation of Windows, and is even integrated with the Windows Explorer GUI.
Why is there no command-line hook for this, like there is on Linux? This seems like such a large and basic oversight.
(I am aware of 3rd party tools, I am not interested in them)
-
Thomas Dickey about 5 yearsThe same program that's used on Linux is also available for Windows (info-zip is not part of Linux).
-
Moab about 5 yearsSee this....serverfault.com/questions/39071/…
-
phuclv about 5 yearsas for the reason why, just Microsoft can answer. But there are a lot of ways that you can create a zip archive from command line, even without PowerShell. Cross-site duplicate: creating batch script to unzip a file without additional zip tools
-
-
cowlinator about 5 yearsThis is a great answer! You should also post this answer on serverfault.com/questions/39071/…
-
Ramhound about 5 years@cowlinator - Why would I submit a question on a different community? I am a member of this community? This question was within scope here at Super User. Besides, somebody already suggested PowerShell, as an answer to that question. I don't submit a duplicate answer to a question, nor do I submit the same answer, to multiple communities.
-
cowlinator about 5 yearsThat powershell answer is a lengthy powershell script. Don't worry about it, I will answer it then.