- Jan 9, 2018
- 713
- 1,830
Sam If you ever get tired of having to split the embedded files into chunks due to batch file string limitations, you could use something like this:
test.bat
Also, just out of curiosity, why is the stuff packed in cab files? If you are already using powershell to concat the chunks, why not use the Expand-Archive cmdlet and regular zip files? Backward compatibility?
test.bat
Code:
@echo off
call :extract_file test.zip
exit
:extract_file
set esc=%~1
powershell -c "[IO.File]::WriteAllBytes('%~f1', [convert]::FromBase64String(((gc -path '%~f0' -raw) -split('--##-- ')).where({$_ -match '^%esc:.=\.%'}).substring('%~1'.length).trim()))"
exit /b
--##-- test.zip
UEsDBBQAAAAAAHerNFG4k+ruBAAAAAQAAAAIAAAAdGVzdC50eHRURVNUUEsBAhQAFAAAAAAAd6s0
UbiT6u4EAAAABAAAAAgAJAAAAAAAAAAgAAAAAAAAAHRlc3QudHh0CgAgAAAAAAABABgAsxM0HoSP
1gEwT5IehI/WAQROWnJ2j9YBUEsFBgAAAAABAAEAWgAAACoAAAAAAA==
Also, just out of curiosity, why is the stuff packed in cab files? If you are already using powershell to concat the chunks, why not use the Expand-Archive cmdlet and regular zip files? Backward compatibility?