SkillAgentSearch skills...

Compressed2TXT

File(s)/Folder(s) "Send to" menu .bat ascii encoder with optional password and makecab lzx compression

Install / Use

/learn @AveYo/Compressed2TXT
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Compressed 2 TXT (formerly File2Batch / res2batch)

Windows 7 support ( PowerShell 2.0 / C# 2.0 )
Very fast encoding and decoding BAT85 and BAT91 classes
Multiple file(s) and folder(s) "Send to" menu selection

preview

What's new in v6.1 final:

GUI option 1: Input decoding key as password - saved in external file output~key.ini
GUI option 2: Randomize decoding key (use with 1)
GUI option 3: BAT91 encoder instead of BAT85 -1.7% size but uses web-problematic chars <*`%\>
GUI option 4: No long lines (adds more overhead)
GUI option 5: No LZX compression (for dense files)
GUI option 6: No txt encoding (cab archive only)

:: prefix to disable syntax highlight in advanced text viewers is always used
encoded text is either split at 128 chars or at <1024 chars to keep lame new windows notepad happy
improved MakeCab ddf generator to handle localized and special characters filenames better
~~two pass MakeCab to reduce size of filenames tree as well~~
improved BAT85 encoder / decoder and added BAT91 alternative
improved handling of multiple selected files and folders as source
prompt to accept or change the randomized decoding key
original cmd / powershell hybrid; script-friendlier $choices variable
skip inaccessible files
better test of non-writable dir with Desktop fallback
support for changed locations of default user folders
makecab single pass (2nd one did not reduce size much)
simplified expand function
fix no choices selected, now default
print total processing time

More about option 1: Input decoding key as password

Yes you can definitely put your own / reuse a randomized key, that's what the option is for and it works great!
but it must be strictly 85 chars long if using default BAT85 or 91 chars long if using new BAT91,
and it must use only non-repeating characters from the base dictionary.
In other words, you can only shuffle the characters around, not add new or repeat them (without editing the script)
That's still quite hard to crack: 85 or 91 minus 6 (MSCAB. :D) *factorial combinations!
Reusing the key is a must when adding multiple bundled files in the same script - all have to use the same key!
Script will verify if input key matches the length and base dictionary and if not provide the information

Finding the right options for your target files

Script has plenty of GUI choices to help you determine the best course of action for the specific file(s).
By default script will LZX compress files. This works best with deep directory structure and lots of small files.
For monolithic huge files that are rather incompressible, you should select option 5: No LZX compression (for dense files)
A ridiculous 259.45MB source file "achieving" 98.94% compression is not worth the extra 4min for saving 1.06%

<details> <summary>Practical example (click here to show)</summary>

Let's say we want something pointless as encoding a huge boot.wim from a mounted iso:
Already know it's incompressible so we can save time, directly selecting option 5: No LZX compression (for dense files)

but just to confirm it, run with just the option 6: No text encoder (cab archive only)

F:\sources\boot.wim
cabonly

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    269,188,732
After/Before:            98.94% compression
Time:                   278.01 seconds ( 0 hr  4 min 38.01 sec)
Throughput:             955.66 Kb/second

not very compressible 256.78MB, and took almost 5 mins

let's see how long it takes after also adding option 5: No LZX compression (for dense files)

F:\sources\boot.wim
nocompress,cabonly

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    36.97 seconds ( 0 hr  0 min 36.97 sec)
Throughput:            7187.11 Kb/second

259.52MB, and took just 37 seconds, so it makes much more sense to encode with option 5

let's do the actual text encoding with option 5: No LZX compression

F:\sources\boot.wim
nolonglines,nocompress

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    40.91 seconds ( 0 hr  0 min 40.91 sec)
Throughput:            6494.56 Kb/second

BAT85 encoding C:\Users\z\Desktop\boot.wim~.bat ...
7.8508956 seconds

334.78MB in ~50s. As expected. For such large files is not worth saving 1-2MB for the cost of extra 4mins

Large files also benefit greatly from not using choice 4: No long lines (more overhead)

F:\sources\boot.wim
nocompress

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    40.75 seconds ( 0 hr  0 min 40.75 sec)
Throughput:            6519.90 Kb/second

BAT85 encoding C:\Users\z\Desktop\boot.wim~.bat ...
7.8476116 seconds

325.68MB. When I say more overhead with No long lines - I mean it.
Just unselecting choice 4 you save more than LZX compress, without the extra 4min time (for this file)!

How about using choice 3: BAT91 encoder instead of BAT85

F:\sources\boot.wim
bat91,nocompress

Cabinet Maker - Lossless Data Compression Tool

272,062,257 bytes in 1 files
Total files:              1
Bytes before:   272,062,257
Bytes after:    272,062,257
After/Before:           100.00% compression
Time:                    36.39 seconds ( 0 hr  0 min 36.39 sec)
Throughput:            7300.26 Kb/second

BAT91 encoding C:\Users\z\Desktop\boot.wim~.bat ...
7.6984016 seconds

320.33MB. BAM! The most efficient text encoder using just built-in tools in Windows 7+

</details>

Typical usage

Used mostly for sharing configs / scripts / dumps / captures as plain-text on message boards that lack proper file attachments, or to safekeep, run multiple tests and sharing binaries in malware analysis tasks

To prevent copy/paste line-endings issues with the script, use github's clone or download - download ZIP button

Uninstall

Compressed 2 TXT.bat adds itself to the Send To right-click menu for convenience in usage. To remove, just run:

cmd.exe /c del /f/q "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo\Compressed 2 TXT.bat"  

BAT85 encoder/decoder details

Tweaked version of Ascii85 that works well with batch syntax highlighter used by pastebin and others

Dictionary (can be randomized):

.,;{-}[+](/)_|^=?O123456A789BCDEFGHYIeJKLMoN0PQRSTyUWXVZabcdfghijklmnpqrvstuwxz!@#$&~
<details> <summary>BAT85 encoded example of 6.1 release with randomized key bundled for auto-extract:</summary>
@echo off & color 07 & chcp 65001 >nul
set "0=%~f0" & powershell -nop -c $f=[IO.File]::ReadAllText($env:0)-split':bat2file\:.*';iex($f[1]); X 1
@pause & exit/b

:bat2file: Compressed2TXT v6.1
$k='efNVd3#S0[R6^T_HlpmA8Xz&D=n|7E5OiI@4PW{}1bQjGC?;rw~.F-q)!+Mvct,YkBxy2Kh9oga$s/LuZJ]U('; Add-Type -Ty @'
using System.IO; public class BAT85 {public static void Dec (ref string[] f, int x, string fo, string key) { unchecked {
byte[] b85=new byte[256];long n=0;int p=0,q=0,c=255,z=f[x].Length; while (c>0) b85[c--]=85; while (c<85) b85[key[c]]=(byte)c++;
int[] p85={52200625,614125,7225,85,1}; using (FileStream o=new FileStream(fo,FileMode.Create)) { for (int i=0;i != z;i++) {
c=b85[f[x][i]]; if (c==85) continue; n += c * p85[p++]; if (p==5) {p=0; q=4; while (q > 0) {q--; o.WriteByte((byte)(n>>8*q));}
n=0;}} if (p>0) {for (int i=0;i<5-p;i++) {n += 84 * p85[p+i];} q=4; while (q > p-1) {q--;o.WriteByte((byte)(n>>8*q));} } } }}}
'@; cd -lit (Split-Path $env:0); function X([int]$x=1) {[BAT85]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force}

:bat2file:[ Compressed 2 TXT_bat
::DoW4QeeeeeYE3Oreeeee_^N!Geeeeee]3P3e||[f$osWonNhwJe||m=?N1d7eeeeeeedz5rRiS|X+XhvPBH|8iw$L7RIp}I_/_zpe&UC[=Gtx6py=K,C|Dkk{rz,liAi|~eR3+w_BY&Mp5?wTqFYb,X@S71&bBUI~9/jmd[-p$|5B_))uiV(&=F!=yK7/D0wSS+e8lWk6c[C[L7z!Yzx!9Qbd$+}eM-gtONCfC9V-kRPb=_Q2W$;de^CVs{5sCCqm^NDTiM68EErm|65vz_;(oqAE?v9Hir[FpQRcO~3Fa4T]z$38IP_N7efIGj8!gYp&C6|y4/p70)SsieR{G,#.quS[.!jkwK4a$HZ[?NpFcg,c&-S}Zw(rGtf3BzwWkS-up3wJBO;@08qrfTwRC1I[=Aw@p5_r~#[XxbiqQC!U}^efIeP5|[-R_WUeAzQFe?RUbN-v2!tsTC@&y}}S^HEFzTyWB,@;dl6Dd0Jw;=#T9@_n5Nr]lL07}4vqKrhP[C0t[]q.e[0nvMzLqtuc.e|@);6w$8wlqoCh&Jm/M_mfJqkEfV#q()9el]/.|_bvxiAyD[PO[8z8B#5X!VkftJBEjG|;{kJS$8N)K-Sf7O,-BU,!ni26&hE)+)gX8w8!-xxY1^1}i5FC.RFHs{8+K1CoNyb1ovZD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Stars238
CategoryDevelopment
Updated2d ago
Forks38

Languages

PowerShell

Security Score

100/100

Audited on Mar 31, 2026

No findings