Skip to content

Commit 676027c

Browse files
authored
Update Compressed 2 TXT.bat
Default to USE_PREFIX=1 Better encapsulation in external scripts by adding at the end of generated output a :bat2file: end
1 parent d2ad407 commit 676027c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Compressed 2 TXT.bat

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@echo off & set "nr=" & set "id=" & title Compressed2TXT v5.2 &rem File(s)/Folder(s) "Send to" .bat ascii encoder by AveYo
1+
@echo off & set "nr=" & set "id=" & title Compressed2TXT v5.3 &rem File(s)/Folder(s) "Send to" .bat ascii encoder by AveYo
22
set/a USE_LINES=1
3-
set/a USE_PREFIX=0
3+
set/a USE_PREFIX=1
44
if not %1.==. goto :CompressAll
55
color 0e & echo. & echo No input file^(s^) or folder^(s^) to encode! use 'Send to' context menu ...
66
copy /y "%~f0" "%APPDATA%\Microsoft\Windows\SendTo\Compressed 2 TXT.bat" >nul 2>nul & goto :End
@@ -9,6 +9,7 @@ set "USE_LINES=%USE_LINES:1=$true%" & set "USE_LINES=%USE_LINES:0=$false%"
99
set "USE_PREFIX=%USE_PREFIX:1=$true%" & set "USE_PREFIX=%USE_PREFIX:0=$false%"
1010
set/a nr=0 & set/a count=0 & for %%# in (%*) do set/a count+=1
1111
for %%# in (%*) do set/a nr+=1 & call :CompressOne "%%~#"
12+
powershell -noprofile -c "[io.file]::AppendAllText('%~nx1~.bat',\"`r`n:\" + \"bat2file\" + \": end`r`n\")"
1213
goto :End
1314
:CompressOne
1415
pushd %~dp1 & set "IsFile=yes" & for /f "tokens=1 delims=r-" %%# in ("%~a1") do if /i ".%%#"==".d" set "IsFile="
@@ -95,7 +96,7 @@ powershell -noprofile -c "$f=[io.file]::ReadAllText('%~f0') -split ':bat2file\:.
9596
if ($count -gt 0){ for ($i=1;$i -le $count;$i++) { $EXPANDER+="X $i;" } }
9697
$EXPANDER += "`"`r`nexit/b`r`n`r`n"
9798
$EXPANDER += @'
98-
:bat2file: Compressed2TXT v5.2
99+
:bat2file: Compressed2TXT v5.3
99100
Add-Type -Language CSharp -TypeDefinition @"
100101
using System.IO; public class BAT85{ public static void Decode(string tmp, string s) { MemoryStream ms=new MemoryStream(); n=0;
101102
byte[] b85=new byte[255]; string a85="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$&()+,-./;=?@[]^_{|}~";
@@ -111,6 +112,5 @@ if ($nr -eq 1){[System.IO.File]::WriteAllLines($id+'.bat', $EXPANDER)}
111112
echo " "
112113
echo "BAT85 encoding $fn ..."
113114
[BAT85]::Encode($fn, $id+'.bat', $uselines, $useprefix);
114-
echo "DONE!"
115-
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
115+
echo " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "
116116
:CompressPS: end

0 commit comments

Comments
 (0)