Tuesday, 7 November 2017

batch file - How can you zip or unzip from the script using ONLY Windows' built-in capabilities?

itemprop="text">

In Windows you can zip some files by




right click →
Send toCompressed (zipped)
folder




And
unzip by double clicking on the .zip file and extract the
files.




Is there a way to apply those
abilities from a script (.bat file) without the need to install any
third-party software
?


class="post-text" itemprop="text">
class="normal">Answer



Back in
2013, that was not possible. Microsoft didn't provide any executable for
this.



See this link for some VBS way to do
this.
href="https://superuser.com/questions/201371/create-zip-folder-from-the-command-line-windows">https://superuser.com/questions/201371/create-zip-folder-from-the-command-line-windows



From
Windows 8 on, .NET Framework 4.5 is installed by default, with href="https://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive(v=vs.110).aspx"
rel="nofollow noreferrer">System.IO.Compression.ZipArchive and PowerShell
available, one can write scripts to achieve this, see
href="https://stackoverflow.com/a/26843122/71312">https://stackoverflow.com/a/26843122/71312




No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...