如何创建 .BAT 文件来下载并解压 zip 文件?
如何创建 .BAT 文件以从 HTTP 服务器下载并解压 zip 文件?
我们有像 http://example.com/folder.zip
这样的链接和像 C:\Users\UserName\Some mix Русский English Adress\
这样的绝对文件夹链接,
如果文件来自zip 存在于目录中,重写它们。
仅使用本机 Windows(xp vista win7 等)BAT 函数和文件。
您可以添加代码示例吗?
How to create a .BAT file to download and unpack a zip file from HTTP server?
We have links like http://example.com/folder.zip
and absolute folder link like C:\Users\UserName\Some mixed Русский English Adress\
if files from zip exist in directory owerrite them.
using only native windows (xp vista win7 etc) BAT functions and files.
Could you add code example, please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试这个混合 bat/vbs 脚本
Try this hybrid bat/vbs script
download_and_unzip.bat:
将
folder.zip
下载到当前目录(或任何其他目录 - 必须存在)。将folder.zip
解压到folder/to/extract
(自动创建)。download_and_unzip.bat:
Download
folder.zip
to the current dir (or any other - must exist). Extractfolder.zip
tofolder/to/extract
(created automatically).如果您确实想使用bat文件,您可以看看: http://www.chami.com/tips/windows/062598W.html
批处理文件将使用名为:URL2File 的命令行工具
编辑:你的批处理文件应该看起来像这样(你需要安装 pkunzip 或另一个命令行工具(7-zip fe))
If you really want to use a bat-file you may have a look at: http://www.chami.com/tips/windows/062598W.html
The batch file will use a command-line-tools called: URL2File
EDIT: Your batch file should look something like (you need to have pkunzip or another cmd-line tool (7-zip f.e.) installed for that)
您可以使用 curl 下载文件。
手册包含几个示例
You can use curl to download the files.
The manual includes several examples
由于 Windows 7 包含 Powershell 恕我直言,您可以使用此 powershell 脚本: http://bwain-dump.blogspot.com/2009/01/powershell-script-to-unzip-many-files.html
如果不是powershell的话,我想,没有本机的做法。您可以使用提供命令行的 zip 实用程序,例如 7-zip
Since Windows 7 includes Powershell IMHO, you could use this powershell script: http://bwain-dump.blogspot.com/2009/01/powershell-script-to-unzip-many-files.html
If not powershell then, I think, there is no native way of doing it. You may go for a zip utility that provides command line eg 7-zip
如果您的 PC 与任何其他 Windows PC 一样,则应该安装 powershell。如果您尝试从 cmd 行或批处理脚本运行它,没问题,您可以将 powershell 一词放在任何命令前面,让它通过 cmd 提示符控制台运行!首先,您应该将您希望人们下载的文件上传到投递箱。然后获取可共享链接,将 www.dropbox.com 替换为 dl.dropboxusercontent.com 以创建不需要人们单击下载按钮的直接链接。然后创建一个像这样的脚本:
这将下载文件并将其解压缩到 C:/ 驱动器
它很简单,并且完全按照其需要执行的操作,不适用于 .RAR 文件。我希望这能解决您的问题。
If your PC is like any other windows PC it should have powershell installed. if you are trying to run it from a cmd line or batch script, no problem, you can put the word powershell in front of any command to have it run its through the cmd prompt console! first you should upload the file you want people to be downloading to drop box. then get a sharable link, replace the www.dropbox.com with dl.dropboxusercontent.com to create a direct link that wont require people to click a download button. then make a script like this:
this will download the file and unzip it to the C:/ drive
it is simple and does exactly what it needs to do, does not work for .RAR files. I hope this solves your problem.