有很多原因想要将文件分割成块 - 主要是为了网络传输(例如电子邮件附件),但我确信有些场景可能需要我无法想象的这种东西。
那么如何将文件分割成可以轻松组装回原始文件(包括非Windows系统)的块呢?
有什么可能性:
-
MAKECAB- 内置的 Windows 存档器 - 它可以压缩文件并
拆分它,但在非 Windows 上很难组合文件
机器。
- WSH/Jscript/VBscript - 可以使用 ADODB 轻松处理二进制文件
Streams。根据我的说法,JScript 更可取。
- .NET/JScript.net/VB/C# - .NET 附带命令行编译器
它也可以用于此目的。 .NET 二进制流可能
在这种情况下是它能提供的最好的。
-
CERTUTIL- 因为它可以将二进制文件转换为十六进制文件并返回
可以使用批处理文件处理十六进制数据并分割文件
成块。
也许 GZipStreams 也可以在它们允许的情况下使用
读取字节(并提供便携式压缩!)。我保证如果有人成功做到这一点(或
提供任何其他方法):-)
不久前,我出于此目的编写了一个名为 BinToBat.bat 的 Batch-JScript 混合脚本。这是它的帮助屏幕:
Create an installer Batch program for data files of any type
BINTOBAT [/T:.ext1.ext2...] [/L:lineSize] [/F[:fileSize]] filename ...
/T:.ext1.ext2 Specify the extensions of text type files that will not be
encoded as hexadecimal digits, but preserved as text.
/L:lineSize Specify the size of output lines (default: 78).
/F[:fileSize] /F switch specify to generate a Full installer file.
The optional fileSize specify the maximum output file size.
BinToBat encode the given data files as hexadecimal digits (or preserve they
as compressed text) and insert they into InstallFiles.bat program; when this
program run, it generates the original data files.
You may rename the InstallFiles.bat program as you wish, but preserving the
"Install" prefix is suggested.
You may use wild-cards in the filename list.
If the /F switch is not given, a Partial installer is created:
- You may insert a short description for each file.
- You may insert divisions in the file listing via a dash in the parameters.
- The installer allows to select which files will be downloaded and ask
before overwrite existent files.
If the /F switch is given, a Full installer is created:
- The installer always download all files.
- You may specify commands that will be executed after the files were copied.
- You may specify the maximum size of the output file via /F:fileFize, so in
this case the output file will be divided in parts with a numeric postfix.
If you use /F switch you can NOT rename the InstallFiles??.bat files; the
first one is the installer and the rest just contain data.
您可以从以下位置下载 BinToBat.bat 程序这个网站.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)