Page 1 of 1
Auto-compress exe with UPX after creation
Posted: Sat Feb 09, 2008 2:19 am
by PB
DoubleDutch wrote:It would be good if there was a post compressor on the exe, but I'm sure that it can either be added as some kind of automatic tool.
Your wish is my command.

The following tool is for Windows only.
(1) Download UPX (Win32 console version) from
http://upx.sourceforge.net/
(2) Unzip it and put "upx.exe" in your PureBasic folder (next to PureBasic.exe).
(3) Compile the following single line to an exe called "AutoUPX.exe" and put it
somewhere easy and convenient to find (maybe also next to PureBasic.exe?):
Code: Select all
ShellExecute_(0,"",Chr(34)+#PB_Compiler_Home+"upx.exe"+Chr(34),"--best "+Chr(34)+ProgramParameter()+Chr(34),"",#SW_HIDE)
(4) In the IDE, open the "Tools" menu and select the "Configure Tools" item.
(5) Click the "New" button.
(6) Make a new entry that looks like the following, and click the "OK" button
when done. (Make sure the "Commandline" part matches the location where
you stored "AutoUPX.exe").
That's it! Now, whenever you create an executable, UPX will automatically compress it.

Posted: Sat Feb 09, 2008 9:22 am
by DoubleDutch
Nice, thanks.

Posted: Sat Feb 09, 2008 10:39 am
by Psychophanta
Thanks, this is useful sometimes.
Posted: Sat Feb 09, 2008 10:47 am
by srod
Thank you. This could well come in handy.
Posted: Sat Feb 09, 2008 11:12 am
by Derek
Nice one, PB. Thanks.
Posted: Sat Feb 09, 2008 12:34 pm
by DoubleDutch
It's a pity something like this isn't built-in and selectable on a file by file basis.
Posted: Wed Mar 25, 2009 12:51 am
by J. Baker
Hey PB, can you update the last pic as it isn't showing or just type it? Thanks!
Posted: Wed Mar 25, 2009 6:15 pm
by TerryHough
Thanks PB. Nice tip.
I've been using the UPX Addon from ts-soft at this topic
http://www.purebasic.fr/english/viewtop ... =upx+addon
but looks like the links are broken.
ts-soft is still around here, so maybe he will update the links. His addon allows configuring UPX too.
Posted: Thu Mar 26, 2009 11:27 pm
by PB
Link updated. It's now stored on ImageShack, so should stay there forever.
Posted: Thu Mar 26, 2009 11:58 pm
by J. Baker
PB wrote:Link updated. It's now stored on ImageShack, so should stay there forever.
Thanks!

Posted: Fri Mar 27, 2009 1:19 am
by idle
thanks PB could be very useful