The purpose of this (late-night) post is to show the the possibility of creating portable applications and to encourage you into doing so. I can't teach you how to make one exactly because this depends on which application you choose. I will try, though, to write some headlines for you. Note that many applications cannot be turned into portable ones. Also different people understand the meaning of the word portable differently. When I say portable I only mean small in size, without unnecessary files and without the need to be installed. I also avoided using any commercial tools such as Thinstall.
- Download and decompress UPX. This is a great open source executable packer. I though I had previeusly written about it but I haven't. UPX (which stands for Universal Packer for eXecutables) is probably one of the best executable packers. It will compress any exe, dll or other executable (even Playstation executables!) If you didn't already know executable packers create compressed applications that can still be run just like the uncompressed ones.
- Download the program that you want to make portable. There might be an already portable version but usually it can get even smaller so download it and continue to the next step. If you can only find a version with an installer then download it, install it and continue to the next step.
- You may follow either one of this steps. The first one describes how to do the compression manually. The second one makes use of a small Lua script I made that automates the whole process.
- (Manual compression) The author of the program might have already compressed his executables so you'll need to decompress them (and hope he/she did compress them with UPX).
- Open a DOS prompt (Start Menu->Run->"cmd.exe"->Enter).
- Open the directory where UPX.exe is stored.
- Finally open the directory where you installed the application (could be: "C:\Program Files\application name").
- Now drag'n'drop UPX.exe into the DOS prompts window (or equivalently type the full path to UPX.exe).
- Select the DOS prompt window and type: " -d ".
- Next drag'n'drop the Directory of the installed program into the DOS prompt window (or equivalently type the full path to the directory) and also append a "*.*" (whithout the " of course) after the last "\".
- Finally select the DOS Prompt window (which should contain a line like this: "c:\whatever\UPX.exe" -d "c:\Program Files\application name\*.*") Now press Enter.
- UPX will decompress any executables inside the directory of the installed program. If there are subdirectories inside the directory of the installed program then you will have to repeat this process for them: Drag'n'drop UPX.exe, type -d, drag the subdirectory, press Enter.
- (Automatic compression) Download UPXALL. Then follow the instructions in the information.txt. When you are prompted for a directory you should use the application directory (could be: "C:\Program Files\application name"). Please note that UPXALL is still beta but will probably do the job.
- (Manual compression) The author of the program might have already compressed his executables so you'll need to decompress them (and hope he/she did compress them with UPX).
- Now the hardest part. Copy the installation directory of the program somewhere else and start removing unnecessary files. It's hard to do it right and might not be possible to remove any files at all (it might even be illegal if you want to distribute the portable version). Remove skins, language files or whatever you consider not worthy its size. In some cases you might also have to update some configuration files about the removed skins for example. If you overdo it with the removals you might end up with menu items in the program that do not work. It has never happened to me but in this case you should probably remove these menu items. Don't worry, you don't have to recompile the source code... Just use Resource Hacker on the uncompressed executable, remove the unneeded menu items and then recompress it with UPX. Finally some applications might require other changes in their configuration files. For example you might need to change any references to directories with relative ones. Here is an example. If you make a portable version of Emule and you want to work from your flash drive you should consider that the drive letter of your flash drive won't be the same on every PC. That will make Emule lose the shared directory settings every time the drive letter changes. To avoid this you should open the configuration file of Emule, find the shared directory and the incoming directory settings and then change them with relative naming. For example if the shared directory is inside the directory of Emule you could put a path like this in the shared directory setting: ".\shared". If you don't understand something in this step then please leave a comment and I'll try to explain.
- If you just want to keep the portable version for yourself then you are finished. The directory now contains a portable version of the application (or at least that's how I call it). If you want to publish your application then you should first check if it legal to do so. Read the license of the application. If you are not sure for something, ask the authors.
What about installed programs with any other kind of dependencies like DLLs installed and Windows Registry Entries or something like that? There are few programs which I've Installed who creates C:\Windows\System32\*.dll; *.ocx & also Windows Registry Entries. I do know the *.dll & *.ocx that were installed (using another app to monitor changes on my computer) & also I keep a copy of the Registry Entries but how do anyone can include those files & entries in able to make any application portable?
ReplyDeleteSome applications cannot be made portable because they expect certain files to exist at certain locations. But many of those that place DLLs inside c:\windows\system32\ expect them to be either on the Path or on the working directory. The working directory is the directory where the executable lies. The Path is an environmental variable that inludes several different paths where executables (including DLLs) are seeked if not found on the current directory. So if a portable application requires a DLL the system first searches the working directory for it and if it is not found it will search all the directories in the Path.
ReplyDeleteSo try copying each file, that the portable app says it is missing, from System32 (or some other directory of the Path) into the same directory of the application. I am not sure that it will work but it is worth trying. I think I remember one time when I used this trick to copy an application into a floppy disk but it was during the Windows 95 era so I am not sure if it will work with today's Windows...
To view the directories of the Path open a DOS prompt and type: echo %path%
For the dependencies like dlls and other stuff to get it use a install monitoring tool like "Total Uninstall" and other similar programs, and best way to make a portable app is using the nsis scripting way try browsing www.portableapps.com and go to the forum you will see like 50+ tutorial there that works with almost all applications if you get it right
ReplyDeleteWriting NSIS scripts isn't that easy but I'll give it a try. Also Total Uninstall isn't free. :-( I hope there is some free alternative out there...
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteSome anonymous user left this comment which I rejected. This is a quote from it:
ReplyDelete''InstallRite provides "application cloning" as opposed to "disk cloning", simplifying software distribution.and its FREE''
I found this program and I don't
see how it can create portable applications. If I am not mistaken this is a program that watches the changes that are made during and installation. Perhaps you could use it to see which files are installed in system folders?
Another quote:
''just add portable vurtual pc for testing /instaling apps,,.''
Virtual PC is an PC virtualization (and emulation) program by Microsoft. And as the poster said you can use it to test application, but still I don't know how it helps when you create portable applications...
One last quote:
''Z#Mith''
Is this the posters nickname? I googled it and found some forums posts on www.syschat.com.
using a virtual pc program like VMWare and and using thinstall, it is relatively simple to make a completely portable application. Install vmware server (free download) into a windows environment, install your os and then install thinstall within your os. Take a vm snapshot of the virtual machine before proceding. Start thinstall and have it record the registry before install. Install the application, and then have thinstall scan the changes. Thinstall then writes a directory with all the necessary files to make the application portable. The applications are not generally "thin" but are portable. Remember to return your vm os back to the virgin snapshot when you are finished. You then have an environment to create your next "portable" application.
ReplyDeleteAs I said, this article is about making small and hopefully portable applications. The reason I didn't mention Thinstall is that it's not free...
ReplyDeleteguys, i read it the article and comments. how can i make a portable app which needs .NET version 2 framework to work. and also visual c++ 2008 runtime pack.
ReplyDeletei dont want to work with thinstall, because i used it that way with vmware combination...nu succes....any suggestions?
Very nice article and also i found a tutorial how to make portables while surf webs, if anyone would like read you can go to this link
ReplyDelete-http://wilsont3ch.com/how-to-make-portables-general-information
Cheers
there's a free program that comes with windows 2000 cd (not sure about xp). its called "VERITAS Software" that does almost same job as thinstall. its in the extras folder.
ReplyDeleteA very informative post.
ReplyDeleteThe legality is questionable, but the idea is good for any open source software users out there
Where can i find "veritas sw"? In my Win2K installation cd isn't present...
ReplyDeleteMany thanks in advance.
Weird, where is the file after compressing? the command line says its done but nothings created
ReplyDelete@Said: I assume that you talk about UPX. UPX compresses the executable itself. It will not create a second compressed executable, the compressed executable will replace the original. :-)
ReplyDeleteI made a program portable but can't find where it has been stored :S
ReplyDeleteThe free "VERITAS Software" that comes with windows 2000 cd is "Wininstall". I am not sure, but I think the software editor is Insight. An other software to making package is Avocent of Landesk.
ReplyDeleteI got an email explaining what InstallRite does:
ReplyDeleteInstallRite watches for Registry and DLL changes to your computer during an install, registry entries are the reason programs need the host computer, they tell the program where to look for certain things, as well as many of the changes the program makes. InstallRite watches for these changes and than emulates them, creating an artificial Registry within the portable program.
I went to its website but I understood that this program creates setup files and not portable apps. But still I might be wrong or they may has not described it clearly. Actually there is not online documentation or a simple description of what it does, I only found a features list.
I am downloading it now (it's freeware) and if I find it useful I might post again here.
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteWell I have had success with this type of thing B4, and I had to use a Hexeditor to make it portable. Win 95 Era. Sigh. Apps are taking the fun out of everything...
ReplyDeleteHere is very brief description of making successful portable software that I have used many times. You will need these free tools: a) FilePacker.exe; b) Reg.exe found in your Win\Sys32 folder; c)RegSeeker.exe; d) XNView or any icon viewer that can resize icons to 32x32x256 colors. Instructions: 1) Install the software. Search the Registry with RegSeeker for all entries pertaining to the install, particularly the HKEY entries containing any Usernames and Password lines. Export those lines to a singlefile.reg in the program install folder. 2) Open any Uninst.dat file with Notepad to laboriously read any needed .DLL/.OCX files and copy those to the install folder. 3) Execute FilePacker and navigate to the install folder; choose the main executable, then choose Reg.exe .. it will default to the first position. Create the parameter next to Reg.exe .. 'import singlefile.reg'. 4) Continue to locate the desired 32x32x256 color icon. Choose options to show the odometer and to delete all after closing the application. 5) Choose to expand in the c:\windows\temp folder; 6) Choose where to compile your portableware.
ReplyDeleteIf you've done everything correctly, your result will be a single self-executable, program that will dissipate into thin air when you shut it down.
Where does the Portable App go after it is finished?
ReplyDeleteIf I understand what you mean, after compressing it with UPX it will replace the old executable. So it's right where it was before.
ReplyDeleteThere is just freeware solution instead of ThinApp - Enigma Virtual Box located at http://enigmaprotector.com/
ReplyDeleteCameyo | Free Application Virtualization
ReplyDeletewww.cameyo.com/
another..
JauntePE is a suite of tools that allows you to make applications portable by virtualizing access to the filesystem and registry
jauntepe.sourceforge.net/
For the dependencies like dlls and other stuff to get it use a install monitoring tool like "Total Uninstall" and other similar programs, and best way to make a portable app is using the nsis scripting way try browsing www.portableapps.com and go to the forum you will see like 50+ tutorial there that works with almost all applications if you get it right
ReplyDeleteProbably one of the worse Explanation and tutorial I have ever seen! And What happends when you Compress the files, where are they located after compressing them! There is now where anything about it. And right now I just packed 200 MBS x 2 times and I dont even know where the HELL it went! WHAT A SHAME!
ReplyDeleteThe first sentence says in HUGE letters: "Don't read this article. I've written a much better one which you can find here. "
ReplyDeleteAlso the files are compressed in place. That's why I instruct you to "Copy the installation directory of the program somewhere else and start removing unnecessary files." right after you haev finished with the compression. Else I would tell you "copy directory X to somewhere else..."
Apps are fictional so laws don't apply.
ReplyDelete