2014-12-09 2 views
0

Я пытаюсь создать пакетный файл, который хранит в нем один или несколько больших файлов в качестве закодированных в base64 строк, а затем преобразует их обратно в файлы. Я слежу за первым ответом на этот вопрос: Store a file inside of a batch file?, но я пытаюсь сохранить файл ~ 3mb в этом пакетном файле, а когда дело доходит до записи источника файлов обратно в файл (через echo), пакетный файл похоже, сбой. Я получаю всплывающее сообщение о том, что «Windows Command Processor перестала работать».Хранение большого файла в пакетном файле

Есть ли ограничение на то, сколько файлов данных данных может записывать в файл за один раз?

Я правильно выполнил этот пример, изменив имя файла file.tmp на filetest.tmp, но в этом пакетном файле содержится около 47 000 строк (что, вероятно, приводит к его сбою).

Любая идея о том, как обойти это?

Редактировать: certutil закодировал исходные файлы довольно быстро, поэтому я предполагаю, что эта часть не является проблемой.

ответ

0

Предлагаю вам ознакомиться с последней версией моей программы кодирования Binary to Batch: BinToBat.bat; он имеет ряд очень полезных функций для этого типа кодирования. Это экран справки:

Create an installer Batch program for data files of any type 

BINTOBAT [/T:.ext1.ext2...] [/L:lineSize] [/F[:fileSize]] filename ... 

    /T:.ext1.ext2 Specify the extensions of text type files that will not be 
        encoded as hexadecimal digits, but preserved as text. 
    /L:lineSize  Specify the size of output lines (default: 78). 
    /F[:fileSize] /F switch specify to generate a Full installer file. 
        The optional fileSize specify the maximum output file size. 

BinToBat encode the given data files as hexadecimal digits (or preserve they 
as compressed text) and insert they into InstallFiles.bat program; when this 
program run, it generates the original data files. 

You may rename the InstallFiles.bat program as you wish, but preserving the 
"Install" prefix is suggested. 

You may use wild-cards in the filename list. 

If the /F switch is not given, a Partial installer is created: 
- You may insert a short description for each file. 
- You may insert divisions in the file listing via a dash in the parameters. 
- The installer allows to select which files will be downloaded and ask 
    before overwrite existent files. 

If the /F switch is given, a Full installer is created: 
- The installer always download all files. 
- You may specify commands that will be executed after the files were copied. 
- You may specify the maximum size of the output file via /F:fileFize, so in 
    this case the output file will be divided in parts with a numeric postfix. 

    If you use /F switch you can NOT rename the InstallFiles??.bat files; the 
    first one is the installer and the rest just contain data. 

Эта программа была успешно протестирована с файлами 15 размера МБ, которые кодируются в разумные сроки (8-9 минут) и экстрагируют еще быстрее. Конечно, эти времена зависят от используемого компьютера.

Смежные вопросы