Hi All,
Please guide me in the following:
How to create the .bks file at runtime using Batch script.
And the .bks file should be in Unicode format.
Thanks,
Swathi.
Create .bks file using batch script
Moderator: DosItHelp
Re: Create .bks file using batch script
this would be quite hard,
you can try to use this command to convert dec string into hex or ASCII symbol
call cdm /b exit /b %dec%
and this line to catch hex value or ASCII symbol
set hex=%=exitcode% & set ascii=%=exitcodeascii%
in this case your !ascii! would be a binary byte which you can output to file, and %dec% vould be index number of that symbol in table, and you would need to map a whole table of symbols
http://www.utf8-chartable.de/unicode-ut ... &htmlent=1
and compose unicode characters by ascii symbols.
This would be quite hard and slow.
I suggest you to use combo of to lines above to get hex valuer, and XVI32 hex editor script, which would allow to write binary data from set of hex values, this will help to avoid mapping.
some explanation of how scripts works http://www.chmaas.handshake.de/delphi/f ... xviscr.htm
you can combine them with your bat file just by single command line with several arguments which would be passed to script.
Keep in mind that batch files alone not very friendly with binary data, in most cases best option is to search command line took that could write binary files
you can try to use this command to convert dec string into hex or ASCII symbol
call cdm /b exit /b %dec%
and this line to catch hex value or ASCII symbol
set hex=%=exitcode% & set ascii=%=exitcodeascii%
in this case your !ascii! would be a binary byte which you can output to file, and %dec% vould be index number of that symbol in table, and you would need to map a whole table of symbols
http://www.utf8-chartable.de/unicode-ut ... &htmlent=1
and compose unicode characters by ascii symbols.
This would be quite hard and slow.
I suggest you to use combo of to lines above to get hex valuer, and XVI32 hex editor script, which would allow to write binary data from set of hex values, this will help to avoid mapping.
some explanation of how scripts works http://www.chmaas.handshake.de/delphi/f ... xviscr.htm
you can combine them with your bat file just by single command line with several arguments which would be passed to script.
Keep in mind that batch files alone not very friendly with binary data, in most cases best option is to search command line took that could write binary files
Re: Create .bks file using batch script
It's quite difficult to create unicode files but it's possible.
That's the way I would create such a file:
Regards
aGerman
That's the way I would create such a file:
Code: Select all
@echo off &setlocal
set "bksFile=%userprofile%\Local Settings\Application Data\Microsoft\Windows NT\NTbackup\Data\test.bks"
:: save the current codepage
for /f "tokens=2 delims=:" %%i in ('chcp') do set /a oemcp = %%~ni
:: switch to ANSI codepage
chcp 1252>nul
:: create the BOM (UTF-16 little endian)
>"%bksFile%" set /p "=ÿþ"<nul
:: write the content in unicode mode
cmd /u /c >>"%bksFile%" echo D:\^
&>>"%bksFile%" echo D:\FolderName\ /exclude^
&>>"%bksFile%" echo SystemState
:: switch back to ASCII codepage
chcp %oemcp%>nul
:: maybe further code here
Regards
aGerman