It seems that the most popular article on this blog is "How to make portable applications" written back in 2007. Reading it again, I believe it is somewhat outdated and it covers mostly how to reduce the size of an app and not how to make it actually portable (meaning leaving no traces and carrying the registry settings along to other computers).
In this article I will include some more methods to make portable apps and I will also introduce PAL, the Portable Application Launcher: a small program I made to wrap applications and turn them into portable ones. Obviously everything here is for Windows users. Also do not forget that it's almost impossible to make an app portable if it uses its own drivers.
Legal stuff
Do not forget that it might be against the license terms of a program to fiddle with its installation. And keep in mind that redistributing some apps in portable form could be infringing copyrights and thus illegal. Blah blah blah you know this stuff... In order to be safe you either have to respect the law, or to make sure they won't get you...
Legal stuff
Do not forget that it might be against the license terms of a program to fiddle with its installation. And keep in mind that redistributing some apps in portable form could be infringing copyrights and thus illegal. Blah blah blah you know this stuff... In order to be safe you either have to respect the law, or to make sure they won't get you...
Method 1: Plain old UPXing and manual file removal
This is the method I described in the older article. It will work with some programs, specifically those that don't use the registry to store settings or any directories like %appdata%. If you want to try this method, then the first thing you should do is install the program you want to make portable using the authors instructions and run/exit it at least once. Don't forget that if you install the 64bit version of an application, it will only work on 64bit Windows.
Now we should see whether your app stores anything in %appdata% (%appdata% is a directory in your hard drive where applications store files like save-games or settings files). My %appdata% is at C:\Users\Tritonio\AppData\Roaming. To see where is yours, press Win+R (Win is the Windows key on your keyboard) to bring up the Run dialog. Then type %appdata% and press enter. A folder should pop up. There you can find subfolders made by different programs that you have installed or ran in the past on your computer. If the program you are trying to make portable has a subfolder here, then you should probably skip this method. Don't forget that the program doesn't necessarily use its name for the subfolder, it could be its company's name for example, so look thoroughly!
After you've made sure that there is no subfolder there you should also take a look in the %localappdata% and %userprofile% folders, just like you did for %appdata%. Fewer applications store data there usually, but you shouldn't risk it, so please check those places thoroughly. Again, if you find a subfolder there, then this method is not for you.
Now you have to make sure that the app doesn't store anything in the registry. Again bring up the Run dialog by pressing Win+R and then type regedit and press enter to open the registry editor. There, navigate to HKEY_CURRENT_USER\Software and then to HKEY_LOCAL_MACHINE\SOFTWARE and look for any subfolder that could belong to the program. If you find one, then your program stores settings in the registry and this method won't work.
Now that you've made sure there are no stray settings you can start packing your application. Go to program files (I guess that's where you installed it) and find the folder that contains it. If you are on a 64bit OS, then you should probably look at c:\Program Files (x86). After you find that directory, copy it somewhere (like a flash drive) and take that copy to a different computer (it could be a virtual machine) with the same OS as you computer.
On the second computer run the main executable. It could complain about dll's missing. If that's the case, then search for them in your first computer (Where could help) and copy them right next to the main executable of the program. You might need to do this many times (bringing the flash drive back and forth) so using Dropbox to sync those files easily would be a good idea.
After the program stop complaining about missing files you are pretty much finished. Now you will just have to compress every executable in it. I suggest you use ArcThemAll for that. Install it, run it, go to settings, UPX tab, select LZMA and click OK. Then drag and drop the whole copied folder on ArcThemAll main window. After it adds all files in the list, select UPX from the bottom left drop-down list, click Extract and then START. This will decompress all executables in case they were already compressed so when it finishes, click Compress and then START again to recompress everything using LZMA (which usually compresses better).
That's it. Your copy should contain a portable version of the app you wanted. If you fell lucky and want to further reduce the size of it, you can start erasing files from the copy. For example many apps keep different language files while you only need one. Still feeling lucky? Why don't you try removing unecessary resources form the executable files using Resource Hacker? You can even replace image resources with lower resolution ones to save a few more KB. Just remember that Resource Hacker will not work on compressed executables so use ArcThemAll to extract everything first.
Method 2: Portable Application Launcher
Method 2: Portable Application Launcher
If you are reading my blog you might have noticed some portable versions of some apps that I have made. I am using a "homemade" wrapper for them called PAL. I originally made it to pack Angry IP Scanner for personal usage (I haven't published it anywhere, yet) but it should work for many apps that use the registry to store settings or in some folder like %appdata%.
PAL uses an INI file, which you will have to manually edit. A typical file will look like this:
[PALOptions]
Executable="App\ares.exe"
RegistryPath="HKCU\Software\Ares"
FilesPath="%localappdata%\Ares"
The first line is always the same.
The second line is the main executable of your portable app. This is what PAL will execute. In this case it is called ares.exe and should be in a folder named App next to PAL's executable.
The third line is the registry path where the portable application is storing it's settings. When you exit the portable application, PAL will copy the settings in that registry path to a file called PortableRegistry.dat (placed right next to PAL's executable). When you start the portable app again (by launching PAL of course as it will act as a wrapper for it), PAL will copy the settings in PortableRegistry.dat back to the registry, so that the program won't know that they were even missing.
The fourth line is a path in the filesystem where the portable app stores any kind of files (for example savegames). Just like before PAL will move these files into a folder named \PortableData when you exit the portable app and back to the filesystem when you rerun it.
So just like in the first method, install the program you want to make portable. Then download PAL from here, unzip it somewhere and copy the program's directory from the place it was installed right next to PAL.exe. You may rename that directory to App if you want (just like in the sample INI file above).
Then run and exit it once and start searching as described in the first method for places in the registry or in the filesystem where the installed program might be storing settings. Currently PAL can only handle one registry path and one filesystem path. This is adequate for most apps I've seen. If you app uses, for example, two folders in the filesystem to store settings, PAL will not be able to completely handle that app, meaning it will leave traces or not even work.
After finding where this app stores its settings, open and edit PAL.ini. Edit the Executable= line so that it points to the main executable of your application. The RegistryPath= line should point to the registry path where you application stores its settings. If your app doesn't use the registry just delete this line completelly. The FilesPath= should point to the place in the filesystem where your app stores files or settings. As you can see in the sample INI above, you may use enviroment variables like %appdata% etc. If your app doesn't use a directory in the filesystem to store data, then just delete this line completelly. When you are done editing it, save PAL.ini. You may also rename PAL.exe to whatever you want but do not rename PAL.ini.
Now take that portable version to another computer (again, it can be just a virtual machine) to test it by running PAL.exe.
In case you wondered what happens if you try to run the portable version of an app on a computer that already has that app installed, PAL can handle that just fine. It will first backup the local version settings to appropriate files, copy the portable settings to the registry and/or the filesystem (replacing the local settings), run the program and when the program exits it will save the settings back to the portable files and then bring back the old local settings that it has backed up.
The only thing that PAL might not be able to handle is a shutdown before closing the portable app. In cases like these it might not have time to cleanup the portable settings or bring back the local settings (if any) from the backup. If this happens to you just rerun PAL on the same computer and it will probably fix everything.
Keep in mind that PAL is still in beta so there might be bugs. So if you find any, leave a comment! Oh and since many people asked, you can change PAL's icon either by recompiling it with a different icon (AutoIt3 source code is included in the zipfile) or you could use ResHacker to change the icon.
Method 3: Using ThinApp
First of all ThinApp is proprietary software and is really, I mean REAAAAAAAALY, expensive. Like $5000-expensive... It wasn't made just for making portable apps but I bet more than 80% of the people that use it, have torrented a cracked version and are using it to make portable apps. There is a trial version too which you can get from their site. The general procedure is this:
Oh and one more thing: Do not compress executables with UPX before packing them with ThinApp, that will break some apps (like 7zip).
Method 4: Using Mojopack
I recently found out Mojopac. It's an app that will allow you to carry around a virtual machine in your flash drive. You can install any application on your flash drive and it will run portably without affecting the host operating system. The major drawback is that it requires XP and doesn't yet support Vista or 7 so I won't write more about it because I currently use Windows 7. In addition to that, Mojopack doesn't actually create portable applications that can be distributed to other users, it just allows you to carry applications in a virtual container, essentially sandboxing them from the host OS.
Method 5: Using Cameyo
I also recently discovered Cameyo. It's a program that works like ThinApp. You'll have to install it on a virtual machine and then it will capture the installation of a program and turn it into a portable executable. It differs from Thinapp in some ways though.
First of all its free of charge!
Secondly you don't necessarily need to setup a virtual machine as they provide an online service (called Cameyo Cloud Packager) where you upload an installer and it automatically creates a virtual image for it. That online service has some limitations though. The installer of the program should be silent or at least have a command line option to make the installation silent. For many installers that option is -silent. Another limitation is that it will only allow you to use the online service for 6 portable apps every month.
Finally Cameyo first creates the portable executable and then you can customize its options while Thinapp required you to decide for all options before building the project to create the portable executables.
When you use the Cameyo Cloud Packager I suggest that you select a 32bit baseline environment and don't use the default which is a 64bit OS.
I tried the online with the setup of Image Analyzer and it recognized that the installer wasn't silent so it prompted me for command line options that would make it silent. I tried -silent and it worked. After some minutes an email arrived at my inbox with a link for the online image. For some reason the image was named image without having any extension at all. I renamed it to image.virtual.exe and ran it. It worked just fine. Then I edited with Cameyo and at the first tab of the package editor I selected Under the executable's directory in the Data storage setting so that the application actually stores the settings next to it. So if can't or don't want to use the online service then you'll have to use a virtual machine just like with Thinapp.
Method 1, the one I had already described in the past, will only work for a few programs. In fact I just rewrote about it because I didn't want this article to include anything less than the older one. Method 2 is something new and I've used it for quite a few apps. For example BOINC Portable andBitcoin Portable (defunct) both use modified versions of PAL. Method 3, using ThinApp, is the most expensive and I really don't see how someone could follow it without downloading a cracked ThinApp version. Method 4, using Mojopac, will not work on Windows 7 and looks more like a portable virtual machine rather than a way to make portable applications. Method 5, using Cameyo is a probably a very good bet for most applications and their online service will free you from the burden of setting up and running a virtual machine.
Still not satisfied? Take a look at this list in wikipedia.
Got questions? Just leave a comment.
So just like in the first method, install the program you want to make portable. Then download PAL from here, unzip it somewhere and copy the program's directory from the place it was installed right next to PAL.exe. You may rename that directory to App if you want (just like in the sample INI file above).
Then run and exit it once and start searching as described in the first method for places in the registry or in the filesystem where the installed program might be storing settings. Currently PAL can only handle one registry path and one filesystem path. This is adequate for most apps I've seen. If you app uses, for example, two folders in the filesystem to store settings, PAL will not be able to completely handle that app, meaning it will leave traces or not even work.
After finding where this app stores its settings, open and edit PAL.ini. Edit the Executable= line so that it points to the main executable of your application. The RegistryPath= line should point to the registry path where you application stores its settings. If your app doesn't use the registry just delete this line completelly. The FilesPath= should point to the place in the filesystem where your app stores files or settings. As you can see in the sample INI above, you may use enviroment variables like %appdata% etc. If your app doesn't use a directory in the filesystem to store data, then just delete this line completelly. When you are done editing it, save PAL.ini. You may also rename PAL.exe to whatever you want but do not rename PAL.ini.
Now take that portable version to another computer (again, it can be just a virtual machine) to test it by running PAL.exe.
In case you wondered what happens if you try to run the portable version of an app on a computer that already has that app installed, PAL can handle that just fine. It will first backup the local version settings to appropriate files, copy the portable settings to the registry and/or the filesystem (replacing the local settings), run the program and when the program exits it will save the settings back to the portable files and then bring back the old local settings that it has backed up.
The only thing that PAL might not be able to handle is a shutdown before closing the portable app. In cases like these it might not have time to cleanup the portable settings or bring back the local settings (if any) from the backup. If this happens to you just rerun PAL on the same computer and it will probably fix everything.
Keep in mind that PAL is still in beta so there might be bugs. So if you find any, leave a comment! Oh and since many people asked, you can change PAL's icon either by recompiling it with a different icon (AutoIt3 source code is included in the zipfile) or you could use ResHacker to change the icon.
Method 3: Using ThinApp
First of all ThinApp is proprietary software and is really, I mean REAAAAAAAALY, expensive. Like $5000-expensive... It wasn't made just for making portable apps but I bet more than 80% of the people that use it, have torrented a cracked version and are using it to make portable apps. There is a trial version too which you can get from their site. The general procedure is this:
- Get ThinApp. Get VirtualBox.
- Install VirtualBox.
- Create a new virtual machine and install a copy of Windows on it. Prefer the same version as the one you are running. For more detailed instruction look here.
- Install the Guest Additions.
- Transfer ThinApp's setup files in the virtual machine. You can use the Shared Folders functionality to tranfer files into the VM and back.
- Install ThinApp.
- Take a snapshot of the virtual machine.
- Transfer the installer of the app you want to make portable to the virtual machine.
- Start ThinApp Setup Capture inside the virtual machine (it's somewhere in the start menu).
- Following the instructions there, ThinApp will create a snapshot of your OS inside the VM.
- When the snapshot is ready, ThinApp will tell you to install the application. Don't worry if the installation requires restarts.
- Complete the installation of the app
- At this point you may also customize the app if you want. Just run it and change any settings you want.
- When the installation is finished open ThinApp's window and click next until you get to screen where it tells you to select the main data container. You should select the main executable of the application. For example if you were making VLC portable you will have to select vlc.exe. All captured data will be packed inside that executable. If you have checked any other applications in the list they will merelly be shortcuts to the main data container. For the inventory name use something containing the name and version of the app.
- When you are asked for a Sandbox Location select USB Flash.
- When you are asked for compression choose Fast Compression.
- Leave other options to their defaults.
- Finally build the project by clicking Build Now.
- Click Browser Project and navigate to the bin folder where you will find the portable executable(s). Transfer them back to your computer and run them there to test them.
- Shutdown the virtual machine.
- To make another application portable restore the saved snapshot of the virtual machine (which contained a clean state where only ThinApp was installed on the VM) and continue from step 8.
Oh and one more thing: Do not compress executables with UPX before packing them with ThinApp, that will break some apps (like 7zip).
Method 4: Using Mojopack
I recently found out Mojopac. It's an app that will allow you to carry around a virtual machine in your flash drive. You can install any application on your flash drive and it will run portably without affecting the host operating system. The major drawback is that it requires XP and doesn't yet support Vista or 7 so I won't write more about it because I currently use Windows 7. In addition to that, Mojopack doesn't actually create portable applications that can be distributed to other users, it just allows you to carry applications in a virtual container, essentially sandboxing them from the host OS.
Method 5: Using Cameyo
I also recently discovered Cameyo. It's a program that works like ThinApp. You'll have to install it on a virtual machine and then it will capture the installation of a program and turn it into a portable executable. It differs from Thinapp in some ways though.
First of all its free of charge!
Secondly you don't necessarily need to setup a virtual machine as they provide an online service (called Cameyo Cloud Packager) where you upload an installer and it automatically creates a virtual image for it. That online service has some limitations though. The installer of the program should be silent or at least have a command line option to make the installation silent. For many installers that option is -silent. Another limitation is that it will only allow you to use the online service for 6 portable apps every month.
Finally Cameyo first creates the portable executable and then you can customize its options while Thinapp required you to decide for all options before building the project to create the portable executables.
When you use the Cameyo Cloud Packager I suggest that you select a 32bit baseline environment and don't use the default which is a 64bit OS.
I tried the online with the setup of Image Analyzer and it recognized that the installer wasn't silent so it prompted me for command line options that would make it silent. I tried -silent and it worked. After some minutes an email arrived at my inbox with a link for the online image. For some reason the image was named image without having any extension at all. I renamed it to image.virtual.exe and ran it. It worked just fine. Then I edited with Cameyo and at the first tab of the package editor I selected Under the executable's directory in the Data storage setting so that the application actually stores the settings next to it. So if can't or don't want to use the online service then you'll have to use a virtual machine just like with Thinapp.
- Get Cameyo. Get VirtualBox.
- Install VirtualBox.
- Create a new virtual machine and install a copy of Windows on it. Prefer the same version as the one you are running. For more detailed instruction look here.
- Install the Guest Additions.
- Transfer Cameyo in the virtual machine. You can use the Shared Folders functionality to tranfer files into the VM and back.
- Take a snapshot of the virtual machine.
- Transfer the installer of the application you want to make portable in the virtual machine.
- Follow the steps shown in this video:
- To make another application portable restore the save snapshot of the virtual machine (which contained a clean state where only Thinapp was installed on the VM) and continue from step 7.
Method 1, the one I had already described in the past, will only work for a few programs. In fact I just rewrote about it because I didn't want this article to include anything less than the older one. Method 2 is something new and I've used it for quite a few apps. For example BOINC Portable and
Still not satisfied? Take a look at this list in wikipedia.
Got questions? Just leave a comment.
Method 1: why do you have to compress the executables?
ReplyDeleteTo reduce the size of the program. Method 1 was described in an older post which mostly aimed at creating small portable programs, although it doesn't always work for executables that use the registry or some system folders.
ReplyDeletePortable applications are awesome! I had no idea you could create them yourself; I hope I'm tech-savvy enough to do it. If not, I may be able to get friends to help, I suppose. Also, if anyone is interested, there's a big master list of already created portables over at http://etoolsonline.com/my-rig/
ReplyDeleteUsing latest Cameyo's latest beta, I was able to create a portable application on first try. Dropbox service is optional
ReplyDeleteok well the problem says " The program has been launched from a network drive. Unable to continue. please copy the program to your local disk drive and try again." any help?
ReplyDeleteHello electric shock. I actually meant to leave a message on the chat but here is OK too. :-D When do you get this message? After packing you program as a portable app? Also which program did you use to pack it?
ReplyDeleteHow would I portabilise Quark XPress without it leaving any trace in the registry? which was is best [excluding thinapp]?
ReplyDelete[logged in on public terminal]
If you don't manage to use PAL you can also try Cameyo.
ReplyDeleteI suppose Cameyo would work if I used the Virtual Machine option... but not on a system with software already installed!
ReplyDeleteYes don't do it a system full of software as some shared files might not be captured since there is no need for them to be reinstalled.
ReplyDeleteHow would I do it with Method 2, and Quark XPress 9?
ReplyDeleteJust follow the steps in method 2. If it only uses one registry folder then the process should be about the same with the one in the video I've included. It won't necessarily be easy for a big program like this.
ReplyDeleteHi
ReplyDeleteI was wondering if possible to give some info about making portable the Adobe Acrobat application Version 8, 9 or even X. I’d appreciate to find a way for the application to run from a USB device but without files, logs, folders or any other trace let in the host OS. It seems impossible without creation of files in folder like "C:\Users\%Profile%\AppData\LocalLow\Adobe"
Thanks so much
what do you if the program used the roaming folder
ReplyDeletei tried %roamingappdata% ddint work
Anonymous your best bet is Cameyo or Thinapp using the instructions I gave. Just don't forget to check if it's legal to make it portable.
ReplyDeleteOokami try opening a command line and typing SET and pressing enter. This will print all enviromental variables. For example I see the following two:
LOCALAPPDATA=C:\Users\Tritonio\AppData\Local
APPDATA=C:\Users\Tritonio\AppData\Roaming
So it looks like you are looking for %APPDATA%.
Ok ty so in pal
ReplyDeleteFilesPath="%appdata%\test" ?
and yes your right it printed out
APPDATA=C:\Users\ookami\AppData\Roaming
i was just confused since in the video it was in local where my program stored it in the roaming folder
it works ty :D now how do it go about changing the icon?
ReplyDeleteCool. :-) Now you either recompile PAL with your own icon (source code is included) or you can use Resource Hacker (http://www.angusj.com/resourcehacker/) or some other resource editor to edit the icon of any exe.
ReplyDeleteReally nice Article! Thanks~
ReplyDeleteHey! I want to take the serial number in it with the app. No other entries, so no %AppDara% line in PAL.ini. Noob question: what ot write to RegistryPath?
ReplyDeleteI have written this:
[PALOptions]
Executable="StrataFoto3D\StrataFoto3D.exe"
RegistryPath="HKEY_LOCAL_MACHINE\Software\Strata\Foto 3D\Installation"
The prog opens, but says, the serial is not good. I made everithing, written in Method 2, using PAL.
How good it would be!
Try using "HKLM\" intead of "HKEY_LOCAL_MACHINE\" and if still doesn't work come back here again.
ReplyDeleteThere is now a better solution then all the one described here: the "enigma virtual box". I am not at all related to the developper. I tried it and it works great! See you! Frank
ReplyDeleteThis is a good article. What about the launcher from PortableApps.com and using NSIS. Can you include this option into your article with the detailed instructions?
ReplyDeleteI'm aware of both of them but I have used neither. I've seen NSIS scripts and I wouldn't say they are easier to use than PAL to be honest, although they provide more functionality if needed. In other words I haven't used them enough to be able to write a tutorial for them. (isn't portableapps launcher a NSIS script too?)
ReplyDeleteAs for Enigma, I've used it and it works almost like Thinapp. I may add it to the article too.
thanks for your article.
ReplyDeleteSoryy, im from INDO, my be can't speak english well.
DeleteI'm using " UNIVERSAL EXTRACTOR "...to extract installer.exe.
Then i'm install aplication in diferent drive /not C:drive.
Im copy for dll or missing file from FOLDER extract Universal Extractor...in directory my aplication.
then im package using WINRAR.
So its works.
But not all aplication can using this method.
I can make portable aplication like PHOTOSHOP,COREL, FRUITY LOOPS, SONAR,etc.
Im not backup registry...couse im asumsing Windows can find automated this.
Thanks for this excellent article! I made Sandboxie portable using Method 5. Now I can take all of my rescue tools with me, and instantly make new portable apps on the fly!
ReplyDeleteYour PAL program is fantastic and so simply to use. Only change I would recommend is making it easier to include command line arguments.
ReplyDeleteCurrently these can be included as part of the executable path in the .ini file, however this means having to duplicate the whole folder each time you want to have a different set of command line arguments.
If you could make it so command line args sent to the pal.exe file would be passed on to the target executable, we could have several shortcuts to the pal.exe file, each with a different set of arguments.
Great work though, thanks very much :)
Hi Max. I made what you asked. I am testing it now and I'll post about it later. Check the frontpage for updates.
ReplyDeleteHi tritonio, I try to install cameyo software on my pc but it does not install, and i can not make some portable program from my pc .
ReplyDeleteI bi thanks full if you answr my.
Hi tritonio, I try to install cameyo software on my pc but it does not install, and i can not make some portable program from my pc .
ReplyDeleteI bi thanks full if answr my.
Hi anonumous. What do you mean it doesn't install?
ReplyDeleteWhat if in the PALOptions I wanted to reference to a shortcut instead of the executable? I ask because any one can put some command lines in the target text box in a shortcut, but I'm not sure how you would do something like that with the executable alone.
ReplyDeleteI'm not sure if you can reference a shortcut. Try it though. If you have a shortcut named "Test" then the actual file has an extension .lnk so try referencing "Test.lnk" and see if it works. But a shortcut contains a full path AFAIK so it won't be reall portable. In that case if you want to run the executable with extra parameters you can create batch files for that and EITHER reference them or even better make them call PAL.exe with those parameters and PAL will pass those parameters on to the referenced executable IIRC. Tell me how it goes and if you still have problems I'll try to change the code a bit to help you.
ReplyDeleteUnfortunately, it didn't work. I named the shortcut "test," and in PALOptions I referenced it as "test.ink" and "test" but the PAL loading bar just appeared and closed down.
DeleteBut I actually found what I was looking for in Max's post.
Thanks!
hello my brother. i am from turkey.
ReplyDeleteI like this blog. And i am a student. and programmer c#-java.
See you again.(ı hate apple , too.)
:)
It's encouraging to see that there still are people who write amazing blog posts, as much of the stuff nowdays is just reblogging. Amazing article. Props to you man.
ReplyDeleteThank you both Thunder618 and Anonymous for your kind words. :-)
ReplyDeleteThe PAL download contains the DarkComet trojan.
ReplyDeleteIt does not. The best AVs on VirusTotal do not detect it. From the ones that detect it only Malwarebytes is trustworthy, but it detects it using AI detection, so it's a heuristic detection.
DeleteUnfortunately PAL is written and compiled with AutoIt3, and because many viruses have been written in that language, this causes most AutoIt3 binaries to be detected as viruses by many AV products. I challenge you to write a simple "hello world" program in AutoIt3, compile it, change the icon of the binary to a custom icon and not get detected by a load of AVs.
In any case, the source code of PAL is included in the zipfile, so feel free to review it and compile it yourself.