Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: Clyde on October 31, 2006
-
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.
-
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.
-
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 ;)
-
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.
-
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?
-
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.
-
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.
-
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.
-
Cheers dude.
-
Will that work for any version of UPX?
As it doesnt appear to be compressing some of my exes.
-
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.
-
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.
-
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 . . .
-
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?
-
Ok will do and thanks. I had this kind of problem before with FBIDE and resources.
Cheers Cirux.
-
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.
-
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.
-
How could we test this out?
Thanks,
Clyde.
-
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.
-
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
-
Cheers Jim, nice one.
-
Has anybody sussed this out with Windows Vista?
-
It's the same under Vista, except Documents and Settings has moved (yes, AGAIN!).
It's now
c:\users\jim\documents
which would make your path
C:\Users\Clyde\Documents\PC Arena\Tools\UPX\upx202w\upx -9
Jim
-
Cheers Jim :)
-
I cant seem to find where to put the batch file so I can use the Send To / Left click like with winzip etc; in vista. Is it a hidden folder?
Cheers and many thanks,
Clyde.
-
Found it:
C:\Users\[UserID]\AppData\Roaming\Microsoft\Windows\SendTo\