• Welcome to Dark Bit Factory & Gravity.
 

Creating a batch file for UPX.

Started by Clyde, October 31, 2006

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Clyde

Does anyone know how to create a batch file using UPX, and then being able to click on an EXE so that you can send the program to the UPX Batch File so it can be compressed; without the need for using the command prompt each time?

Cheers and many thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Shockwave

Well, you can make a batch file with notepad to do pretty much anything..
Put your commands in the batch file and save it with a .bat extension.
That should work fine for you.
Shockwave ^ Codigos
Challenge Trophies Won:

ninogenio

youll need your enviroment details set in windows if you have windows xp

then got to start and right click my computer and propertes now go to enviroment variables scroll down your system variables to path and click edit and add the path of the upx folder where the exe lies to the varialbles already there make sure you have a semicolon ; before and after the path or it wont work.

now what thats done is let you acsses upx from anywhere under the cmd prompt.

to make the bat file create a new txt file and add your switches to the new file it will probably be something like this

upx -c my.exe /this is just submizing where i put upx just put the actuall name of the upx.exe and im not sure what or if the -c will be needed have a read through the upx read me/

then save it as make.bat

put the bat file next to my.exe click it and it should* do the work for you.

if any of thats unclear or if it simply doesnt work just give us a post and ill download upx and get it going for you bud ;)
Challenge Trophies Won:

Clyde

There was a way of doing it as I had it on my machine before I had to reformat and re-install; but I can't find where I got the information.

Im stuck as I dont know what the commands are for dealing with any file via UPX and the "Send To" list which you get from doing a right click on the mouse. If you could give us a hand Nino that would be superb.

Cheers and many thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

ninogenio

i just downloaded it there and changed my eviroment variables to as i said above then made a .bat file by making a new txt file and adding this

upx my.exe

and saved it to make.bat and it worked but im not quite sure thats what your wanting as it would mean making a new bat file for each exe?
Challenge Trophies Won:

cirux

What I have is just a text file called upx.bat with


c:\upx\upx -9 %1

pause


And can drag exe's on to it and it will overwrite the file with the compressed version.

Clyde

Thanks Nino & Cirux.

How can I have that in the Send To List?
Where you right Click, for example the same list that Winzip is on, there's a Send To.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

cirux

Yeah you can just copy that bat file into

c:\documents and settings\[username or all users]\send to


You need to have show hidden files option on to see the send to menu (if its not on you can enable show hidden files from any explorer window ->tools->folder options.

Clyde

Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

Will that work for any version of UPX?
As it doesnt appear to be compressing some of my exes.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

cirux

Quote from: Clyde on October 31, 2006
Will that work for any version of UPX?
As it doesnt appear to be compressing some of my exes.

Is the upx file saying there was no compression or windows? I noticed windows doesn't always update the file size info straight away, I have to right click properties or refresh the screen a few times.

Clyde

There's nothing being displayed at all once I've sent the file to the batch file. All I get is the press a key from the pause command.
Im using UPX202w.

Cheers Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

This is what I get mate:


C:\Documents and Settings\Clyde>C:\Documents and Settings\Clyde\My
Documents\PC Arena\Tools\UPX\upx202w\upx -9 "C:\Documents and Settings\Cly
de\My Documents\Free Basic Arena\My Freebasic Programs\Brimstone\Brimstone.exe
"
'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\Clyde>pause
Press any key to continue . . .
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

cirux

Looks like UPX doesn't like being in a directory with spaces in it? Maybe try put it in c:\upx or similar and see if that works?

Clyde

Ok will do and thanks. I had this kind of problem before with FBIDE and resources.
Cheers Cirux.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Clyde

That worked nice one mate, funny that I had upx in the same location when I had an older version and it worked from being in a directory with spaces. Bizzarre.

Thanks Cirux.

All the best,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

cirux

No problem, glad I could help. Thinking about it more, I wonder if its because of it being used in a batch file that causes the problem and not UPX.

Clyde

How could we test this out?

Thanks,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

cirux

I will try a few things out with UPX (I am using the same version as you) and batch files to check, will let you know what I find out.

Jim

You've just missed out some quotes.  You need quotes round each part that has spaces in.
ie.
This is (somelthing like) what you have in your batch file...

C:\Documents and Settings\Clyde\My Documents\PC Arena\Tools\UPX\upx202w\upx -9

It should be

"C:\Documents and Settings\Clyde\My Documents\PC Arena\Tools\UPX\upx202w\upx" -9


Jim
Challenge Trophies Won: