如何仅使用 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
右键单击 →发送到 →压缩(zipped)文件夹
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 开始,默认安装 .NET Framework 4.5,使用 System.IO.Compression.ZipArchive 和 PowerShell 可用,可以编写脚本来实现这一点,请参阅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屋!