In PHP i'm creating a bunch of batch files (based on what settings a user gives) that need to be downloaded and executed on the users computer.
I trought it would be nice if the user only has to download an executable file that is a self extracting archive and contains a bunch of batch files and other tools.
The self extracting file has to:
- Extract to a given path without asking the user for it, for example c:\insttemp
- Run a batch file after extraction, for example: c:\insttemp\start1.cmd
- Have no user interaction (unattended, so not even a confirmation) so a user is'nt able to do it wrong, just download and run.
I am able to create such a file using 7z (7zip command line utility) and an executable header i can copy in front of the file: (copy /b header.bin + settings.cfg + archive.7z executable.exe) but i dont think this is a very nice and stable solution.
This way i have to:
- Safe all the files from php in a temp folder on the server
- exec("7z blah blah") to archive them
- exec("copy /b blah blah") to make it self extracting
- Offer the file for downloading
I know i can save files to a .zip archive in php directly, wich is already way more stable, but i cant convert a zip file to a 7z file without unpacking it, so exact the same problem, even more steps.
I know i can make a self extracting file from a zip file using command line tools, but i cant give them the exact extracting path and a file to run afterwards _without_ user interaction (well i did'nt find one yet and looked up over 50 different tools).
Anyone has an idea to make this nice?