PortableApps.com Platform and Suite 1.6 have been released.
Compress exe/dll/jar Script![]() Submitted by John Bentley on February 26, 2007 - 9:57pm
I was wondering when will we get the script that compresses exes and dlls? ( categories: )
|
PortableApps.com Platform and Suite 1.6 have been released.
Compress exe/dll/jar Script![]() Submitted by John Bentley on February 26, 2007 - 9:57pm
I was wondering when will we get the script that compresses exes and dlls? ( categories: )
|
UPX/7-zip
What you are looking for is UPX for your exe's and your dll's. JAR files are just zip files (only the extension changes). Therefore, you can use 7-Zip for that. Just un zip, and re-zip using higher compression. Once you are finished change the extension from zip (or 7z) to jar.
---------------
Marge: Homer, the plant called. They said if you don't show up tomorrow don't bother showing up on Monday.
Homer: Woo-hoo. Four-day weekend.
"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin
I believe he was asking
I believe he was asking about the script to compress everything that John mentioned under the Development link. Unzipping and recompressing jar files one-by-one takes a rediculous amount of time
The developer formerly known as ZGitRDun8705
Ooohhhh!!!!
My apologies, I just have never bothered looking at the dev. page. But now I know what he means.
---------------
Marge: Homer, the plant called. They said if you don't show up tomorrow don't bother showing up on Monday.
Homer: Woo-hoo. Four-day weekend.
"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin
I was planning
On asking John about that if he ever emails me back
(I have a sneaking suspicion that he's on holidays again)
----
Ryan McCue
Person 1: Oh my god. You will never believe what just happened.
Person 2: What?
Person 1: I can't remember, I've forgotten.
"If you're not part of the solution, you're part of the precipitate."
Simple batch
You can use this simple batch file for the .JAR file(s):
For .EXE and .DLL files, you can use the following command:
Some official recursive stuff would be a lot more more fun, of course
.
You could try using the FOR
You could try using the FOR command like in Ryan's UPX example and put all the commands on one line separated with the ampersand
build work dir
(begin FOR_loop) extract & repack & flush_work_dir (end_FOR_loop)
remove work dir
No need to build/remove the work dir for every jar file, (unless it's easier to code that way of course)
I'll look into this whole thing more tonight if I get some time.
Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!
Here's what I did with your
Here's what I did with your script to make it recursive and not have to use a batch to call another batch.
Take it for what it's worth since it's "unofficial".
Throw Ryan's commandline for UPXing executables and you've got the start to a decent all-in-one application compressing batch file.
Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!
Wow
Awesome, man
.
With to more lines after the core loop, you can have the universal compressor:
That needs some cleanup
%_upx% needs to be defined
You can combine those two lines into one (no need to loop thru the files twice)
Those aren't the portableapps.com "recommended" switches for UPX
You could add in the lines for "if not exists" for upx.exe like the original batch file above did for 7zip if you want it to be more fancy.
Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!
That's a bit messy. It would
That's a bit messy. It would be nice to have upx process all dll/exe files in a directory, or (even better) have upx process everything in a single step. You could use for to create filenames instead of having it simply pass one file to upx at a time. Have for pass directory names as parts of arguments passed to upx. The output looks much better (and upx will calculate total savings, which is quite nice).
(Boring.)
For loop bug?
Sorry to dig this old thread up, but I was trying to create a little program to do this based upon the script above when I ran into a problem.
Sometimes, when I use the "for" loop, some files get inserted twice. UPX, 7-zip and optipng all try to compress the files twice when this happens. I think that this has something to do with the for loop in the batch command, because it happens with all three exe's.
Basically, the first time the file is UPX'ed and/or optipng'ed correctly as usual. A few files later, I see that the batch loop tries to recrompress one or two of the files again -- and of course it fails. This does not really bother me except that when I am re-jarring, this could take some time -- and sometimes the re-jar goes into an endless loop of re-jar's.
Has anyone else had any problems like this? I have tried and tried again and this behavior looks completely random (I am sure that it is not, but it looks random).
If this is a known problem, I would love to know how to solve it. Otherwise, Bahamut, I would love to know the batch command to do what you wrote just above.
Thanks everyone. CD
AppCompactor
These scripts are no longer necessary. Just use the PortableApps.com AppCompactor:
http://portableapps.com/apps/utilities/appcompactor
Sometimes, the impossible can become possible, if you're awesome!
I do use it
I do use AppCompactor. I am doing this to learn more about dos batch scripts, autohotkey and programming in general. Call it personal development.
Found a typo
I'm re-doing all my scripts and I found a typo in the original JAR recompression script posted to this thread and the one I did later that uses recursion.
This line:
Needs to be changed to:
Cancer Survivors -- Remember the fight, celebrate the victory!
Help control the rugrat population -- have yourself spayed or neutered!