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 sys开发者_Python百科tems.
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.
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.
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.
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.
精彩评论