Author Topic: Creating a batch file for UPX.  (Read 14126 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Creating a batch file for UPX.
« 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.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Creating a batch file for UPX.
« Reply #1 on: October 31, 2006 »
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:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Creating a batch file for UPX.
« Reply #2 on: October 31, 2006 »
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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #3 on: October 31, 2006 »
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:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: Creating a batch file for UPX.
« Reply #4 on: October 31, 2006 »
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:

Offline cirux

  • Atari ST
  • ***
  • Posts: 129
  • Karma: 4
    • View Profile
Re: Creating a batch file for UPX.
« Reply #5 on: October 31, 2006 »
What I have is just a text file called upx.bat with

Code: [Select]
c:\upx\upx -9 %1

pause

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

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #6 on: October 31, 2006 »
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:

Offline cirux

  • Atari ST
  • ***
  • Posts: 129
  • Karma: 4
    • View Profile
Re: Creating a batch file for UPX.
« Reply #7 on: October 31, 2006 »
Yeah you can just copy that bat file into

Code: [Select]
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.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #8 on: October 31, 2006 »
Cheers dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #9 on: October 31, 2006 »
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:

Offline cirux

  • Atari ST
  • ***
  • Posts: 129
  • Karma: 4
    • View Profile
Re: Creating a batch file for UPX.
« Reply #10 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.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #11 on: October 31, 2006 »
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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #12 on: October 31, 2006 »
This is what I get mate:

Code: [Select]
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:

Offline cirux

  • Atari ST
  • ***
  • Posts: 129
  • Karma: 4
    • View Profile
Re: Creating a batch file for UPX.
« Reply #13 on: October 31, 2006 »
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?

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #14 on: October 31, 2006 »
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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #15 on: November 01, 2006 »
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:

Offline cirux

  • Atari ST
  • ***
  • Posts: 129
  • Karma: 4
    • View Profile
Re: Creating a batch file for UPX.
« Reply #16 on: November 01, 2006 »
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.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Creating a batch file for UPX.
« Reply #17 on: November 01, 2006 »
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:

Offline cirux

  • Atari ST
  • ***
  • Posts: 129
  • Karma: 4
    • View Profile
Re: Creating a batch file for UPX.
« Reply #18 on: November 01, 2006 »
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.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Creating a batch file for UPX.
« Reply #19 on: November 01, 2006 »
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...
Code: [Select]
C:\Documents and Settings\Clyde\My Documents\PC Arena\Tools\UPX\upx202w\upx -9
It should be
Code: [Select]
"C:\Documents and Settings\Clyde\My Documents\PC Arena\Tools\UPX\upx202w\upx" -9

Jim
Challenge Trophies Won: