So, everyone knows about portables, right? Basically, a single exe you launch by double-clicking and your program is started without fuss or bother; no installation or setup required, just run and go. They're portable, so you can keep them on a thumb drive and use them from any computer. There is a strong appeal for me to use portables in lieu of full installations (even in Windows) because I work on many different computers and need a complete set of tools at the ready on any given machine. Portables allow me to move my 'workbench' from one PC to another, regardless of hardware type or OS by simply plugging in a flash drive. I also need the same tools available in any PE I boot and the tools need to be updatable. This is what is meant by 'universal' portable applications; the free use of them in any work environment and the ease of moving them anywhere you want.
Most portables you find will already work in Windows but many will not work correctly running from PE. That's where ppApps come in, these are special portables designed to 'know' where they're being launched from and act accordingly. e.g. CCleaner, even their portable version will automatically access the registry and system files of the OS its launched from. This is great for Windows but makes no sense in PE where you want to work on the currently offline system. Thanks to Paraglider's runscanner, we can redirect programs like CCleaner to work on the host system. In Winbuilder scripts, this is accomplished by adding commands to the shortcut in PE but in a portable, this must be done internally, running some batch code as part of the program launch. Fortunately, SFX (self-extracting archive) packagers like WinRAR allow for this and are ideal for creating universal portable applications.
I will be presenting a series of applications packaged as universal portables with detailed explanations on how they're setup. I'm a big believer in using examples to learn from; if I can see how someone else does something then I can apply that knowledge for my own needs. There are many different ways of doing the same things and I'm hoping others will offer their favorite methods so we can discuss best practices and improvements. I'm really hoping this can be more like a blog than a tutorial; I'm all about learning better ways of doing things
I'll start by setting some ground rules for how a universal portable should behave (then give some examples).
1) The program should launch from any medium (CD/DVD/USB/UFD/HDD) and on any platform (Windows XP/7 PE1/3x) with minimal external support (self-contained); currently testing in Windows XPx86, 7x64 and in LiveXP/Win7PE_SE but should work in other projects as well.
2) The single exe (SFX) works independently in Windows and PE; additional support files for PE only needed for full (script like) installation e.g. file association and shortcuts. In other words, the single exe works fine on its own but if you want full install in PE, add the support files; ppapp.ini, setups.cmd and pe.reg.
3) The SFX (launcher) is able to check system parameters e.g. Windows or PE; XP or 7; x86 or x64 and launch the program accordingly without user intervention*
*There are cases where a prompt e.g. to keep or delete temp files or select a folder is appropriate (more on this later) but this should be kept to a minimum and only used when required.
4) Background activity should be hidden wherever possible i.e. command windows, archive unpack progress etc. This is another reason the application needs to launch quickly; basically, the only thing you should see when dbl-clicking the exe is the program interface launching normally.
CCleaner 3.12.1572 x86/64 Portable
Homepage: http://www.piriform.com/ccleaner
Portable: http://www.mediafire...61yyd83ctmdmqk8
Nice, multi-function system cleaner, comes with x64 version of exe and is setup as follows:
@echo off setlocal set RegQry=HKLMHardwareDescriptionSystemCentralProcessor0 reg.exe Query %RegQry% > lOS.txt find /i "x86" < lOS.txt > lSC.txt if %ERRORLEVEL% == 0 ( if /i '%systemdrive%'=='x:' goto pe if /i '%systemdrive%'=='y:' goto pe CCleaner.exe goto end :pe Runscanner.exe /t 0 /sd /ac /m+ /y CCleaner.exe goto end ) ELSE ( if /i '%systemdrive%'=='x:' goto pe if /i '%systemdrive%'=='y:' goto pe CCleaner64.exe goto end :pe Runscanner.exe /t 0 /sd /ac /m+ /y CCleaner64.exe ) :end endlocal del /f /q lOS*,lSC*,cc*,port*,run* del %0
or you could just do
del /f /q *to clear out everything in Temp (not a bad idea)
To examine all the files in the package, just rt-click the SFX and select Extract files...
A brief explanation of each:
cc.cmd (above) is the setup batch which launches when SFX is run; this checks the system architecture (x86/64) and whether it's launched from a PE system; if PE, ccleaner(64).exe is run via runscanner or, if Windows, just starts the exe. This is a simple launcher but does everything you need it to. More complicated examples to follow.
cc.js just hides the command window for cc.cmd. This is a standard file you'll find in almost every setup and the only thing that changes is the name of the cmd it runs; in this case cc.cmd.
"cmd.exe /c cc.cmd"
CCleaner(64).exe, ini and dat files are program related (came with program, required to run)
RunScanner*.exe and dll are included for system re-direction support when running from PE.
Test the setup by copying all files to Temp and running cc.js; when ready, create an SFX launcher as follows:
[attachment=12895:wrar1.png] [attachment=12896:wrar2.png] [attachment=12897:wrar3.png]
The rest of the options are unimportant but be sure to select an icon for your SFX.
Use ResHacker or similar to extract the icon from your exe and select it under 'Load SFX icon from file' option.
--
Here's another, virtually identical setup.
Extract the files and see for yourself how this setup can be used as a template for other programs.
ProduKey v1.53 x86/64 Portable
Homepage: http://www.nirsoft.n...key_viewer.html
Portable: http://www.mediafire...l2x4g4coat8r4po
--