Home » Notes » How to compress executables into smaller size – UPX

How to compress executables into smaller size – UPX

NOTE: for experienced users only. if shits happen, at least you will know what to do.

UPX is a nice small tool to compress executables into smaller size. this makes them load faster. with the most common hardware today (i.e. fast CPU and abundant RAM), this is a good thing to do.

for instance, this is how i compress my Mozilla Firefox in Microsoft Windows:

  1. first, make sure Firefox are not running.
  2. download upx from sf.net. get the windows version (archive filename should be something like upxxxxw.zip).
  3. open the zip file and extract only upx.exe (this is the only executable that you need to do the job)
  4. my firefox was installed in c:\Program Files\mozilla\firefox. so i put upx.exe inside the folder (actually, i put it into my folder that store essential files, and then i put the folder path into my user-only PATH environment variable. this means i can access them anywhere in command prompt just by typing the file name, instead of full path).
  5. run command prompt. in Windows 7 (or Vista), you can do this by clicking on the start button > All Programs > Accessories > right-click on the Command Prompt and select “Run as administrator” (you need to make sure that the command prompt is run under the privilege of administrator, unless you have turned off UAC entirely)
  6. change the current directory to your Firefox installation folder. for me that means typing cd “c:\Program Files\mozilla\firefox”
  7. when you are in the correct directory, type the following, and let it run until it stops:
    for %v in (*.exe *.dll components\*.dll plugins\*.dll) do upx “C:\Program Files\mozilla\firefox\%v”
  8. that’s all.

you can try it on other applications too. but bear in mind that if shits happen, it’s not my fault.

Tags:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.