Reducing Size

When you create a portable you should pay attention to its size. If you want to put it on your USB stick, it should be as small as possible but also should be fully functional.

The most obvious way to reduce size is to delete some irrelevant files. Usually there are some files in a program’s directory which are not needed to run the program. You may delete them but make sure that you delete only those files which the program doesn’t need.

These files may be:

• log files (.log, .txt) if you don’t want any log files. You may also need to disable logging in the program’s settings to ensure the log file won’t come back again on next run.
• .gid, .cnt files: these are help file’s accessories as I know. Although it is re-generated when you launch the help file but you can delete them to reduce size temporarily.
• help files (.hlp, .chm, .pdf, etc.). Delete these files only in cases when you are 100% sure you don’t want to use it later. If you plan to share your portable with other people you shouldn’t delete these files as others may need them.
• some smaller text files, info files, html files, files without extension, etc. These files may contain licence details, ordering info, general info about the software, and so on.
• language files: these can be in various formats. If you don’t want any other languages beside you own language, you can delete other ones. But again, if you want to share it with others you shouldn’t get rid of them.
• some image files, but make sure the program runs well even if these images are missing
• skin files: some program come with an enormous number of skins and they may take up very much disk space. If you want to reduce size you may delete them. If the program needs at least one skin file to run, select one that suits best to your likings and delete the others.
• source files: I almost always include the source file of my portable launcher and I encourage you to do the same. Doing so, people may look at the code and can see what’s going on when they launch the launcher and they can also learn from it. But if you are not so generous you may delete these files.

Another way to reduce size is using UPX.


UPX is a free, portable, extendable, high-performance executable packer for several different executable formats. It achieves an excellent compression ratio and offers very fast decompression. Your executables suffer no memory overhead or other drawbacks because of in-place decompression.

The beauty of upx is that it compresses .exe, .ocx, .dll and .com files with an excellent ratio and these files can be launched directly after compression. So, you may reduce a size of an executable that was originally 2 MB to 1 MB and it remains usable.

Although upx is a very nice tool to reduce file size you must use it with care. Some programs won’t accept upx-ed files so always backup them before compressing them. If the programs starts up as expected you should thoroughly test to make sure every function of the program is working properly.

My experience is that compressing .exe files is safe, if they run after compressing they’ll probably run without any problems. But compressing .dll, .ocx and .com files is not so obvious so you should test them.

The NSIS script has a line that says:

;—–Runtime switches—-

CRCCheck off

This disables CRC check so the launcher will not check if its size is the same as it was when creating it.

If you change it to “CRCCheck on” and compress it with upx, you’ll get an error when you try to launch the resulting .exe file:

NSIS Error

The installer you are trying to use is corrupted or incomplete.

This could be the result of a damaged disk, a failed download or a virus.

You may want to contact the author of this installer to obtain a new copy.

It may be possible to skip this check using the /NCRC command line switch

(NOT RECOMMENDED).

If you want to protect your portable launcher, use “CRCCheck on”. If a virus modifies the size of the launcher it simply will not run and thus protects your computer from being infected. And because your portable may travel from one computer to another it is greatly exposed to virus attacks.

Until now I did compress my launchers with upx because I was a brave man. But as I reread my last few lines I thought I shouldn’t be so brave…

You can find upx in directory “ToolsUPX 2.03″ so you do not need to download it. But I recommend to check if there’s a newer version available before using it.

You can see in its website how to use UPX from command line. Here’s an example for compressing “toobigfile.dll” (with maximum compression):

“D:ToolsUPXupx.exe” -9 “H:Datatoobigfile.dll”

And another one for decompressing:

“D:ToolsUPXupx.exe” -d “H:Datatoobigfile.dll”

To compress files with upx I use it from command line but I created a context menu with PowerPro so I only have to select files and select “Compress with UPX” or “Uncompress with UPX” from the context menu. It is not a built-in feature but you should add it manually. I won’t discuss PowerPro here; see the website or itsforumfor more info about it.

Using it from command line is somewhat cumbersome if you have a large number of files to compress so I recommend you to use a GUI for that like UPX Mass Compressor, UPX Shell, UPX-itor other tools. Unfortunately from this list only UPX Mass Compressor has the ability to compress several files at once but maybe you’ll find another great GUI for it on the net.

One response to “Reducing Size”

  1. wilsont3ch.com » How To Make Portables

    [...] 12. Reducing Size [...]