仅使用Windows的内置功能,如何从脚本中压缩或解压缩? [英] How can you zip or unzip from the script using ONLY Windows' built-in capabilities?
问题描述
在Windows中,您可以通过
In Windows you can zip some files by
右键单击→ 发送到→ 压缩(压缩)文件夹
right click → Send to → Compressed (zipped) folder
然后双击.zip
文件解压缩并解压缩文件.
And unzip by double clicking on the .zip
file and extract the files.
是否可以通过脚本(.bat文件)应用这些功能,而无需安装任何第三方软件?
Is there a way to apply those abilities from a script (.bat file) without the need to install any third-party software?
推荐答案
早在2013年,那是不可能的. Microsoft没有为此提供任何可执行文件.
Back in 2013, that was not possible. Microsoft didn't provide any executable for this.
有关某些VBS方式的信息,请参见此链接. https://superuser.com/questions/201371/create-zip-命令行窗口中的文件夹
See this link for some VBS way to do this. https://superuser.com/questions/201371/create-zip-folder-from-the-command-line-windows
从Windows 8开始,默认情况下使用 https://stackoverflow.com/a/26843122/71312
From Windows 8 on, .NET Framework 4.5 is installed by default, with System.IO.Compression.ZipArchive and PowerShell available, one can write scripts to achieve this, see https://stackoverflow.com/a/26843122/71312
这篇关于仅使用Windows的内置功能,如何从脚本中压缩或解压缩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!