Git Product home page Git Product logo

compressed2txt's Issues

How to use 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
this issue is the same as the other "how to use it", I accidentally repeated it 😅

How to use 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

How to change Bat code to pure PowerShell code?

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

Compressed2TXT and WinXP

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

Error running as Administrator

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 . . .

BAT91 not working

for a large file more than 3mb, it said:

2021-11-04_01-27-43

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

  • '@; cd -Lit($env:CD); function X([int]$x=1){[BAT91] <<<< ::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del $x -
    force}
    • CategoryInfo : InvalidOperation: (BAT91:String) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

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

  • '@; cd -Lit($env:CD); function X([int]$x=1){[BAT91]::Dec([ref]$f,$x+1,$x,$k); expand -R $x -F:* .; del <<<< $x -
    force}
    • CategoryInfo : ObjectNotFound: (C:_\7z\1:String) [Remove-Item], ItemNotFoundException
    • FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
      `

Don't compress, no source file specified

Снимок экрана 2024-02-15 084054
Снимок экрана 2024-02-15 084131
After installing Windows 23H2 [Version 10.0.22631.3007], I cannot pack the file. The resulting install_old~.bat contains only service code, and when launched, the unpacker writes: "cannot expand a file onto itself: 1." PowerShell 5.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.