I wanted to compress a few DLL's to make a program become smaller sized but this program had several subfolders inside and this was a complication because I wanted to use UPX (the exe/dll compression tool) .
Since upx didn't had an option to do scan inside all available subfolders, I decided to use the FOR command that is available as a NT batch script for this task.
Here is the code that made it possible:
FOR /F "tokens=*" %%G IN ('dir/b/s ^"*.dll^"') DO upx.exe -9 "%%G"
This code will run "upx.exe -9" and mention the exe we want to compress using the variable "%%G"
You can also adapt this code for any other uses, just change the .DLL with whatever extension you wish to find.
- Do notice that upx (upx.exe) needs to be found either on the same folder from where you run this script or inside a windows folder (such as c:\windows).
For knowing the correct syntax of the above mentioned command, I used this guide from Rick Lively here: http://www.geocities...NDS/F/FOR_F.HTM
And here is a script ready for download: compsub.cmd 73bytes 119 downloads