Natively compress / uncompress /encode files in windows batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Natively compress / uncompress /encode files in windows batch

#1 Post by mirrormirror » 24 Feb 2016 16:18

Here is what I would like to do. I really like the idea of dbenham's jrepl.bat program. I think it can solve a lot of problems with special character handling in variables, etc. I want to use it more but there are a couple of external machines that I do not want to maintain an updated library of functions - so I can't call these useful .bat utilities.
So would there be a way to "zip up" jrepl.bat, place the encoded "compressed" content inside of another batch file and then uncompress it on demand within windows (XP & 7). As in:
If NOT EXIST jrepl.bat CALL :Make_jrepl.bat
...

I know that windows has some built-in compression capabilities but am not sure how to access them via batch.

I've seen some of you guys do this sort of thing with .exe files - for example:
viewtopic.php?f=3&t=3428&start=30#p45322
viewtopic.php?t=4881&start=15#p41335

Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Natively compress / uncompress /encode files in windows batch

#2 Post by Aacini » 24 Feb 2016 19:04

I suggest you to review my BinToBat.bat encoding/decoding program.

Antonio

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Natively compress / uncompress /encode files in windows batch

#3 Post by Squashman » 24 Feb 2016 19:09

I use Dave's Jparse and I just tack it on to the bottom of my batch files.

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: Natively compress / uncompress /encode files in windows batch

#4 Post by mirrormirror » 24 Feb 2016 21:05

I use Dave's Jparse and I just tack it on to the bottom of my batch files.

I searched dostips for "jparse" (on google) but didn't get back any results. Can you provide any more info?
I suggest you to review my BinToBat.bat encoding/decoding program.

Thank you - I think between your program and the one from carlos: viewtopic.php?f=3&t=6400 I have a solution.
I just have to say that the stuff you guys do with batch is really pretty cool :) I wish I had more time to digest it all.

einstein1969
Expert
Posts: 961
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Natively compress / uncompress /encode files in windows batch

#5 Post by einstein1969 » 25 Feb 2016 07:12

Hi,

I have not finished but my goal it's the same.

ANY2BAT BASE85

Einstein1969


foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Natively compress / uncompress /encode files in windows batch

#7 Post by foxidrive » 26 Feb 2016 00:07

If size isn't a consideration then this creates a batch script - to create the original file if it doesn't already exist.
You can chain several scripts generated by this in a single batch script, and include it in your own script.

XP Pro has certutil.exe I believe.


Code: Select all

@echo off
set suffix=create.bat
if "%~1"=="" (
  echo( Syntax: "%~0" "filename.mp3"
  echo( to encode the filename.mp3 into a filename.%suffix% batch script
  echo( - any filetype can be encoded into a batch script, even another .bat file
  echo(
  pause & goto :EOF
  )
echo(creating "%~n1.%suffix%"
certutil /encode /f "%~1" "encode.tmp"
find /v /i "CERTIFICATE---" <"encode.tmp" >"encode.tm"
(
echo @echo off
echo if not exist "%~nx1" (
echo echo creating "%~nx1"
echo (
for /f "usebackq delims=" %%a in ("encode.tm") do echo echo %%a
echo ^)^>"decode.tmp"
echo certutil /decode /f "decode.tmp" "%~nx1" ^>nul
echo del "decode.tmp"
echo ^)
)>"%~n1.%suffix%"
del "encode.*"

npocmaka_
Posts: 516
Joined: 24 Jun 2013 17:10
Location: Bulgaria
Contact:

Re: Natively compress / uncompress /encode files in windows batch

#8 Post by npocmaka_ » 26 Feb 2016 02:43

foxidrive wrote:
XP Pro has certutil.exe I believe.




It requires installation of Admin tools pack.

this also uses certutil and makecab. It's only 4kb less than jrepl so I'm not sure it will be not better just to have jrepl (you can remove new lines in begin/end certificate part which will decrease the size a little bit).Or may be we need a package manager for batch scripts?


Code: Select all

@echo off
if not exist jrepl.bat (
   certutil -decode "%~f0" jrepl.cab
   extrac32.exe jrepl.cab /L "."
   del /q /f jrepl.cab
) >nul 2>&1
exit /b %errorlevel%
-----BEGIN CERTIFICATE-----
TVNDRgAAAADpIwAAAAAAACwAAAAAAAAAAwEBAAEAAAAAAAAARgAAAAEAAQDgeQAA
AAAAAAAAWkj2UyAAanJlcGwuYmF0AIn5/gab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7rw6cNnHT4v4PMSPq/g8z18foDPAD4f3K2P+DXepq/JDn3JXfga9OAD/QfQ
fwD9B9B/AP0H0H8A/QfQf8D9B9x/wP0HH6av6YvBfJjtwdeH7trAXZttre19/NK/
u12a9y/usrA/H+ybbpHogHF0OwkPwisZ7bgogjnbRf/Lm9rn2jBLB2qOmQpzAzzn
NUwbnC373a0dW6t+oVVvy9ZqPdeq2xv0ba1eFGHt2lq9LLTqv7K1elVs1bW1+r7Y
qmdr9UMe+/6OdcRBAda6dUS3QIlX1lbjIqyBrdWkAOullaqy0Or715ZWg16R9j/Y
WpW4bcNrsF5sZZOcQYnbVrxK3LbNcVDkdm/d1qrI7d4LW6sit19bsS9wu2fHq8Rt
m3wNSty26dCgxG3rHKf5Vt2BlaolmbBp2mBWbJWTCbWLemjUFUxzPNLRxCb+X1uG
7IhruohQa1gdPD/V0JKoZPxp5wHu2G7R8cJGtqMPowZ4DpbvhM4c1nOw6vBa5Wv/
yrY0YChQh9smurV27HvgL9bM10McCpH4Xw==
-----END CERTIFICATE-----

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Natively compress / uncompress /encode files in windows batch

#9 Post by foxidrive » 26 Feb 2016 03:10

npocmaka_ wrote:
foxidrive wrote:XP Pro has certutil.exe I believe.

It requires installation of Admin tools pack.


Thanks npocmaka.

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: Natively compress / uncompress /encode files in windows batch

#10 Post by mirrormirror » 26 Feb 2016 19:13

May be this will help you :

http://stackoverflow.com/questions/2804 ... s-with-bat

Thank you - this is informative. I've downloaded zipsjs.bat but haven't explored it much yet.
Here is what I gleaned - correct me if I am wrong:
1. certutil can compress/uncompress native zip format
2. makecab can do cab & LZX format
3. zip will probably do better compression (assumption?)

The solution I am gong to use at the moment is this:
1. compress jrepl.bat like this: Makecab /D CompressionType=LZX file file.cab
2. Use bhx.exe from carlos to encode it: viewtopic.php?f=3&t=6400
--- this also generates a creation script which magically decompresses the .cab file created in step 1
The creation script is 13k (the original jrepl.bat is 30k).

I like the idea from Aacini which encoded mulltiple files into one block: viewtopic.php?f=3&t=4842 but it lacks compression. I am still looking at it as there are a few more utilities I want to encode this way.

If size isn't a consideration then this creates a batch script - to create the original file if it doesn't already exist.

So this just encodes the file but doesn't compress - correct?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Natively compress / uncompress /encode files in windows batch

#11 Post by foxidrive » 26 Feb 2016 21:13

mirrormirror wrote:
If size isn't a consideration then this creates a batch script - to create the original file if it doesn't already exist.

So this just encodes the file but doesn't compress - correct?


Yup.

You may want to put everything in one script - and then the task itself will help dictate the best way to go about it. It could be argued in modern days that a script of say 90 KB is trivial to send via email, and the script itself can use the top portion to run in.

But maybe the script will filter it's own code in a tight loop - and a large script would be ungood in terms of bogging down execution time.

Alternately the mess of utilities can be in a single script - called once at the start of your batch files - and leave the single script somewhere on the path.

Just thinking of different possibilities...

mirrormirror
Posts: 129
Joined: 08 Feb 2016 20:25

Re: Natively compress / uncompress /encode files in windows batch

#12 Post by mirrormirror » 28 Feb 2016 20:53

I just thought I'd post a basic proof of concept file creation script in case anyone else finds these useful. I used the solution from carlos mentioned earlier and just made a basic call routine. This script checks for the existence of BOTH jrepl.cmd AND GetTimeStamp.cmd (both provided by dbenham) and will create them as necessary. It will also delete them when complete if you un-comment one line. You can add/delete other utilities if desired.
Notes:
1. These files will be created with the".cmd" extension rather than the ".bat" extension the utilities originally had. I did this to distinguish them from the originals.
2. These are recreated WITHOUT the help/comments section at the beginning to reduce size. I just kept the author and version number in there. Hopefully this is ok.

EDIT: I removed the code based on the comment below from foxdrive
just pm me if anyone wants the code
Last edited by mirrormirror on 29 Feb 2016 16:12, edited 2 times in total.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Natively compress / uncompress /encode files in windows batch

#13 Post by foxidrive » 29 Feb 2016 03:05

mirrormirror wrote:2. These are recreated WITHOUT the help/comments section at the beginning to reduce size. I just kept the author and version number in there. Hopefully this is ok.


Just commenting here from discussions of a similar nature in the past, where it was found that software authors are in general not so keen to have their tools released in a *public* distribution without the built-in help.

If someone uses them in an internal department in a company then it wasn't considered to be a real issue - but then I can't speak for the fellows here.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Natively compress / uncompress /encode files in windows batch

#14 Post by foxidrive » 22 Mar 2016 18:10

My code was a mess to read in the post above, and had lines in the output script file that generated an error message, so I cleaned it up and fixed it.

viewtopic.php?p=45465#p45465

Post Reply