How to make app portable?

12,636

Solution 1

It's a complicated story but let's try to summarize. Starts from the part "why?"

I'm an obsessive guy who seriously "hates" installers. I love to have a clean system without bloated in files reg entries and DLL's. Thats why I make nearly all (at least 97%) of programs that I use portable. I made more than 600 up to today and what I can say is;

You need: 1- A program to watch file system (what included after installation) I use this. Simple and straight (sorry not freeware, but you can find tons of alternates) http://www.samsunsegman.com/um/

2- A program to watch registry (what changed or included after installation) I use this in HTML mode. Free fast and simple. And portable in nature. http://sourceforge.net/projects/regshot/

Now scan the system with these 2, and than run the installer. After open the installed program and make your settings as you want. And than use this 2 program to find the added files and registry entries.

For files, delete them to trash can and take them back from trash in batch (easy to do like that) to the folder of application. Registry, open the related branches in registry, delete any entries containing addressings like (plugins folder = c:\prog.... etc) After right click on main branch and select export. This is your reg settings...

3- Download this program http://ctuser.net/?reg2exe This will convert your reg file to an exe file.

4- Download this application http://download.cnet.com/FilePacker/3000-2216_4-10414081.html Note: Click on "Direct Download Link" if not you'll cnet will welcome you with their installer :)

And with this program (I use this because have no interference with any application) pack the program that you want to make portable. In wizard, first choose your reg-exe file after main programs file. Launcher will execute them with this order. And in setting choose "delete after terminate" will delete the extracted files on exit.

You can discover the further details. This helps you to portabilitize nearly 75% of simple applications.

5- For complicated programs or complicated needs you even can make home made loaders like

  • Before executing the app, put the user files under appdata folder (that I hate)
  • Put settings in registry (even with dynamically modified "path" addresses)
  • Choose which to execute (x86 or x64)
  • Execute in admin mode if needed
  • Execute the app... And when application is terminated...
  • Delete the settings from registry
  • Take the user files from appdata folder and put under programs folder (usb etc) back.
  • Delete left-over files under the system...

I just wrote these last ones to make you understand how far you can go. And for all these extra tricks, I use just and just bat files. And I convert them to exe also with this software. http://www.f2ko.de/programs.php?lang=en&pid=b2e (also free)

All the softwares that I use except "uninstall manager" are free. And with this technique, amazing but some of programs are running even faster.

Actually you can just use JauntePE or portable apps packer things but... Jaunte and similar sandbox making programs are so slow and not compatible with all. Even causing crashes. Portable apps approach is a bit bloated regarding to my strict spped and size standards. That's why I do it myself about for 10 years (yes even people was not talking about portability)

Note: I'm not a programmer, and you also don't need to be to do these. I never released my portables, and you also shouldn't (read EULA's) for respect to authors.

But never forget to demand portable version from all authors. Force them to quit installers ;)

Best regards

Solution 2

Here is a primer for setting up a portable app using the PortableApps.com tools. They have a page for developers that is quite helpful for some specifics, but the overall process is not well summarized. Here is the general outline for creating a portable application:

1. Investigate your application's footprints

Find all the files, registry locations and settings of the application you want to make portable (make use of point (1) and (2) in inovasyon's answer, and maybe take a look at Zsoft). It is usally a good idea to fire-up a virtual machine and track the application's changes without much clutter.

2. The PortableApp generator

Download, extract, and open the PortableApps.com Platform, and follow [The system tray icon][Apps][Get More Apps][By Category] to install the PortableApps.com Launcher, and NSIS (Unicode) needed to Portabilize your app. Alternatively, but with some added hassle, download both the PortableApps.com Launcher and NSIS Portable (Unicode version) as standalones.
You can now compile a project by running the PortableApps.com Launcher and pointing it to your project.

3. PortableApp layout and structure

Download the PortableApp.com Application Template (search for it here) to structure the data and files obtained in (1.) according to the specifications. Also, download some apps from portableapps.com for some practical examples of how they are structured, and to learn more about the struggles of portability (such as the substitution of drive letters in settings files to correspond to the movement of a portable drive).
As a "Hello World" example, try portability this simple program: helloworld.bat, with content:

    @echo off
    echo Hello World > log.txt

It writes all local environmental variables to the log file log.txt. You can play around a bit by trying to writing files to an %APPDATA% subdirectory and see if you can make your project redirect it to a portable directory.

4. Additional usage

If you need to do some additional coding that is not achievable with the default .ini capabilities (such as forcing only one instance of an app), add a NSIS script with file location App\AppInfo\Launcher\Custom.nsh to your project.
Note that PortableApps.com's custom code guide incorrectly states the file location as Other\Source\Custom.nsh. It is also quite unhelpful regarding the layout of this script. Rather look at examples from other Apps and learn the NSIS syntax by Google-ing a bit.

Solution 3

inovasyon did a great job! If you want to make some portable app that will work on every computer you move it to, then 99.9% of apps can be made portable. If you also expect the app to not leave any files, folders or registry entries behind and not change or break things on the host PC's setup, then that limits things a bit further. Apps requiring admin privileges to write to protected areas of the registry or file system will break when used on PCs with locked-down privileges.

Apps requiring services to be installed on the host PC will often leave them behind. You must to know there are apps that are locked to specific PCs - Microsoft's recent versions of Office are a great example of this. They simply will not run when moved to another PC. Also, you'll need some tools for making portable app: cameyo, thinapp, boxedapp, portableapps, spoon, app-v and other. Portable applications will run from a flash drive, and from the computer. Good Luck!

Share:
12,636
lonerunner
Author by

lonerunner

I am Freelance Web Designer and Server Administrator with passion in Photography. My main area of expertise is web development and design. I love making cool stuff on the web, and mainly i work with WordPress and Joomla cms. I am experienced in customizing and developing WordPress driven websites. As a Server Administrator over past years i have built and setup various web servers from shared hosting solutions to dedicated servers for audio and video streaming, gaming servers, and web servers. I also love photography and in my free time i always take my camera out trying to snatch few cool photos. I also do product shots for catalogs, flyers, websites, etc...

Updated on July 19, 2022

Comments

  • lonerunner
    lonerunner almost 2 years

    I have standard instalations of some programs, and althou they are freeware and i can download them and install on any machine, things are not that easy always. When system crash and i dont have working machine or working internet connection or lan card or drivers for lan card i always struggle to find them and make them work if some dependency file is not on that version of windows.

    What i need is to know is how can i make applications portable so i can run them from my usb or just copy them from my usb on pc and run, what dependency files application require, and what files and where specific application install?