aveyo / compressed2txt Goto Github PK
View Code? Open in Web Editor NEWFile(s)/Folder(s) "Send to" menu .bat ascii encoder with optional password and makecab lzx compression
License: MIT License
File(s)/Folder(s) "Send to" menu .bat ascii encoder with optional password and makecab lzx compression
License: MIT License
I'm new in this thing...
I'm trying to store a vbs file into a batch but I don´t know how to store that vbs for example in the desktop. Any helping hand?
thanks
this issue is the same as the other "how to use it", I accidentally repeated it 😅
I'm new in this thing...
I'm trying to store a vbs file into a batch but I don´t know how to store that vbs for example in the desktop. Any helping hand?
thanks
Thank you very much for the hard work of the developers of this project
I want to change the bat code into PowerShell code
My programming level is not good. I tried several times without success, so I want to ask the developer for help. Thank you in advance
In addition, I want to know how to customize the output path, for example: $path ='c:\ABC '
code1---bat
@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='$&Y5OqzhK#sx]F+~,);@m3CaWT0_/Hb(2ekj8N-pr^6ltQ{VndBGJ|SMEo[cvA?9yZ=f!}.i4XwgRDPuUI1L7'; 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:[ test_txt
::W4Nj6$$$$$(+uW]$$$$$+]YEt$$$$$$1q8q$__#&Tz,rIC~$0}$__;T$II_5$$$$$$$5DaP6yG&Nk}Qa+uKH[$5iJ-$Yxja$$&vx$$#z&$$#z&$$#z&$q3mZ$$
:bat2file:]
code2---powershell--no't succeed
$_b = @'
::W4Nj6$$$$$(+uW]$$$$$+]YEt$$$$$$1q8q$__#&Tz,rIC~$0}$__;T$II_5$$$$$$$5DaP6yG&Nk}Qa+uKH[$5iJ-$Yxja$$&vx$$#z&$$#z&$$#z&$q3mZ$$
'@
$k='$&Y5OqzhK#sx]F+~,);@m3CaWT0_/Hb(2ekj8N-pr^6ltQ{VndBGJ|SMEo[cvA?9yZ=f!}.i4XwgRDPuUI1L7'; 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));} } } }}}
'@
function X([int]$x = 1) { [BAT85]::Dec([ref]$_b, $x + 1, $x, $k); expand -R $x -F:* .; del $x -force }
X 1
Is it possible to add a password to the result batch file? When you compress files or folder, you provide a password. When the user click the generated batch file, you need to type the correct password before it generates the original files. This would make the program more useful. Thanks.
I recently used your very useful tool to encode files in a windows shell script (cmd).
It's nice to see that a complete folder and it's file content can be compressed/encoded and later decompressed/decoded in the execution directory of the resulting bat file.
However, you stated compatibility since Win7 and upwards.
Just want to inform you, that your ps code also works under windows xp (SP3) environment with some limitations.
Without modification of the header line in the resulting bat file it will break because you try to switch cp UTF8 via CHCP command inside the cmd/bat file. This is an XP bug; documentations are really difficult to find.
Switching to cp 65001 only works inside the console window itself.
Trying to switch to cp 65001 within any cmd/bat file either breaks further processing or maybe lead to really unexpected results.
Replacing the CHCP value with e.g. 1252 works and makes the batfile go again.
However, when trying to decompress/decode a folder and its file content WinXP extracts only the files in the execution directory.
Till Win7 and upwards also the encoded folder is extracted.
I thought this might be some useful information for you to improve your code in the future.
I assume the cp 65001 setting was made to allow ps to handle multibyte chars in file- or folder names correctly.
Although it seems that you have to waive on this setting in xp, as long as anybody knows his current ACP and uses file/folder names to compress/encode that matches the ACP inside the batch/bat file anything should work flawlessly I think.
You might add some checking procedures?
...just some thoughts of mine.
So far, thanks for your really useful code
Zphere
when i run the .bat this comes out
https://i.imgur.com/Mw4lWwp.png
https://i.imgur.com/9dzZiUm.png
any solution?
Hi, wonderful utility! Thank you!
"Send to" not always convenient. Is it possible to add a GUI window with drag-n-drop? I understand that this is implemented if you transfer files or a folder to a batch file, but this is not always convenient.
For example:
https://gist.github.com/ser1zw/2160887
https://github.com/rlv-dan/Tutorial-code/blob/master/A%20drag-and-drop%20GUI%20made%20with%20PowerShell/powershell-gui.ps1
use Compressed2TXT v6.1
The 1 file it creates is located in C:\Windows\system32
Microsoft (R) File Expansion Utility
Copyright (c) Microsoft Corporation. All rights reserved.
Can't open input file: 1.
del : Cannot find path 'C:\Users\ZYL\Desktop\1' because it does not exist.
At line:8 char:112
+ ... [BAT91]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -force}
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\ZYL\Desktop\1:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
Press any key to continue . . .
for a large file more than 3mb, it said:
Neither works for win7 or win10.
but for BAT85, it works.
I need to paste to somewhere do not accept %*, so how do I fix it?
Thank you all!
`Unable to find type [BAT91]: make sure that the assembly containing this type is loaded.
At line:8 char:56
Microsoft (R) File Expansion Utility Version 6.1.7600.16385
Copyright (c) Microsoft Corporation. All rights reserved.
Can't open input file: 1.
Remove-Item : Cannot find path 'C:_\7z\1' because it does not exist.
At line:8 char:107
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.