(10-21-2024, 05:14 PM)SMcNeill Wrote: I've always just found the easiest way to make a 7z self-extracting EXE is to use the 7z File Manager. Select what files/folders I want, click the Add button, fill out the settings in the pop-up that makes the archive. Just be certain to check the "Make SFX archive" button before clicking OK to finish.
Well, I don't wanna brag, but:
(Let's hear it for ludicrously long Send To menus!)
(Actually, "Quick7z exe" is the one that I would use. The highlighted menu item turns a .ZIP file into a self-extracting .EXE that runs on Windows OR DOS.)
But anyway, the party trick I described actually runs the archived software from Windows TEMP folder then deletes it all without a trace when done.
- Need to compile FIZZBUZZ.BAS and nothing else? Simple click&drag FIZZBUZZ.BAS onto qb64pe_win-x86-3.14.1__(+GCC-13.2.0)_(Vista+)_7zXu.exe and after a few seconds FIZZBUZZ.EXE will magically appear.
- Want to install QB64PE? Open a command prompt and type "qb64pe_win-x86-3.14.1__(+GCC-13.2.0)_(Vista+)_7zXu.exe UNPACK" and voila! There it is!
(I append "_7zX" to the self-extractor file name to remind myself what it is. "_7zXu" files have an UNPACK option.)
(Some anti-malware installations may complain about running executables from TEMP, but I haven't had any problems yet. Knock on wood. If worse comes to worst, 7Zip can unpack it's own installers, and many other types of installers as well.)
Depending on the batch script which drives the package, many other options may be available. Here's an example of what qb64pe_win-x86-3.14.1__(+GCC-13.2.0)_(Vista+)_7zXu.exe can do:
fullauto <name.ext> : Auto-select Basic IDE, or C/C++ console mode compile.
ide [name.ext] : Start the QB64PE IDE.
cmdline : Open a Command Prompt in the QB64Pe temp directory, with PATH set appropriately.
bcomp <name.ext> : Compile using QB64PE with the "-c" & "-s:exewithsource=true" flags.
cc <name.ext> : Auto-select C or C++ console mode compile.
ccon <name.ext> : Compile a Windows console-mode C program.
cppcon <name.ext> : Compile a Windows console-mode C++ program.
cgui <name.ext> : Compile a Windows GUI C program.
cppgui <name.ext> : Compile a Windows GUI C++ program.
make [options] : Run MinGW32 Make.
unpack [path] : create a directory named "qb64pe" in the specified path, which must exist.
Default mode is fullauto if a filename is given and no mode is specified.
Default mode is ide if no filename is given and no mode is specified.
For a compiler suite like PE there is one big batch script driving everything. If the UNPACK option is used then a whole set of batch files are made available (one for each option), allowing simple click&drag operation of the compiler(s) for simple uses.
(A note from the Distributor of TMI: After writing too many batch scripts for too many _7Zx archives I finally created a batch file generator that uses relatively simple .INI files to generate the needed batches.)
(protip for command-line noobs: don't type a stupidly long filename like " qb64pe_win-x86-3.14.1__(+GCC-13.2.0)_(Vista+)_7zXu.exe". Use <TAB> command completion or right-click the .EXE and rename it first.)
The usefulness of this technique is subjective. It started off with an "I wonder...." moment and turned into a pet project from there.