将文件夹压缩为 exe 以在 Windows 中重复使用的最佳方法

发布于 2024-11-30 14:39:19 字数 190 浏览 0 评论 0原文

我有一个有点荒谬的需要,即为最终用户提供一种非常简单的方法,将其系统上的程序文件中的程序目录捕获到自解压文件中,他们可以使用该文件在其他系统上复制该目录。

我想知道我有什么选择来提供尽可能接近一键点击的功能。最终用户不会费心自己压缩它,等等。

这些用户有这种需求,因为我们公司在相当长的时间内没有存档旧安装,并且升级并不总是一种选择。

I have the somewhat ridiculous need to provide an end-user with a VERY easy way to snag a program directory from Program Files on their system into a self extracting file they can use to replicate the directory on other systems.

I'm wondering what my options are to provide this as close to 1-click as possible. End users will not bother with zipping it themselves, etc.

These users have this need because our company did not archive old installs for a sizable gap of time and upgrading is not always an option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

许久 2024-12-07 14:39:19

听起来您好像误以为您可以简单地将目录从一台计算机上的程序文件复制到一台新计算机上的程序文件中,并且它应该可以工作。

大多数 Mac 软件都是这样工作的,如果所有软件都这样工作那就太好了。
遗憾的是,Windows 安装程序经常在不同位置安装各种文件,将关键信息放入 Windows 注册表项,并具有其他注册和反盗版机制,导致该程序无法在新计算机上运行。

请参阅“是否可以仅克隆软件在机器上?”,“复制全部硬盘(具有 32 位 Windows 7)中安装的程序和文件并将其克隆/传输到另一台具有 64 位 Windows 7 的计算机", "有办法吗克隆 NTFS 硬盘但保留一些文件?”,等等。

如果您以某种方式知道您的特定应用程序没有这些外部依赖项,并且在仅复制文件夹,那么也许你可以:

  • 制作一个在您的文件服务器或 CD 上或两者上安装该应用程序的“黄金主”版本(可能在自解压可执行文件中),并使用该主版本安装在所有新计算机上。这种方法保证了“金主”不会受到“金主”创建后创建的病毒的影响。

或者,

  • 由于您已经知道特定应用程序文件夹的名称(如 mtijn 建议的那样),因此创建一个批处理文件,使用该名称和适当的命令行参数调用存档器,以将其压缩为自解压可执行文件。将批处理文件和存档程序放在 U 盘上;也许使批处理程序自动运行。有多种归档程序就足够了——winrar、UPX、WinZip、 7-zip、IExpress 或任何其他支持自解压的方便归档程序档案

It sounds like you laboring under the delusion that you can simply copy a directory from Program Files on one machines, into the Program Files on a new machine, and it should Just Work.

Most Mac software works that way, and it would be nice if all software worked that way.
Alas, Windows installers often install various files in a variety of locations, put critical information into Windows Registry entries, and have other registration and anti-piracy mechanisms such that the program does not work on the new machine.

See "Is it possible to clone only the software on a machine?", "Copy all installed programs & files in a hard disk (which has 32 bit Windows 7) and clone/transfer it to another computer which has 64 bit Windows 7", "Is there a way to clone an NTFS hard drive but leave some files out?", etc.

If you somehow know for a fact that your particular application does not have those external dependencies and will work just fine on the new machine after copying only the folder, then perhaps you could:

  • make a "golden master" version of that application (perhaps in a self-extracting executable file) on your file server or on a CD or both, and use that master version to install on all new computers. This approach guarantees that the "golden master" is free from viruses that were created after the "golden master" was created.

Or

  • Since you already know the name of your particular application's folder, as mtijn suggested, make a batchfile that calls an archiver with that name and the appropriate command-line arguments to compress it into a self-extracting executable. Put the batch file and the archiver program on a USB stick; perhaps make the batch program autorun. There are a variety of archivers that would be more than adequate -- any one of winrar, UPX, WinZip, 7-zip, IExpress, or any other convenient archiver that supports self-extracting archives.
橘寄 2024-12-07 14:39:19

如果您只是在寻找应用程序,那么使用 7zip 创建自解压 zip 可能是一个选择。如果您正在寻找一个库来编写自己的应用程序,那么您可以查看 ionic zip 并使用程序文件文件夹的环境变量来查找该文件夹(但是您只是压缩一个文件夹,其他依赖文件夹怎么样和注册表项?)。或者,如果您愿意复制整个系统,您也可以轻松地对其进行 Ghost/wim。

If you're just looking for an app then creating a self-extracting zip with 7zip may be an option. If you're looking for a lib to write your own app then you could look into ionic zip and use the environment variable for the program files folder to find that folder (but then you're just zipping a folder, how about other dependant folders and registry entries?). Or if you're willing to duplicate entire systems you could just as easily ghost/wim it.

拥醉 2024-12-07 14:39:19

我推荐 winrar 和自解压存档。 winrar 仍然是最好的存档和压缩程序之一。不是很贵。您将获得终身更新和支持许可证。自解压存档有很多选项,例如不同的预处理和不同的压缩器。它可以将存档分割成不同的大小。它有一个纠错代码,可以与命令行一起使用来编写脚本。这是一个完美的一键式解决方案。

I would recommend winrar and a self-extracting archive. winrar is still one of the best archive and compressor program availabe. It's not very expensive. You get a liftime update and support license. Self-extracting archive has many options like different pre-processing and different compressors. It can split the archive into different size. It's has an error correction code and it can be used with the command-line for scripting. It's a perfect 1-click solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文