Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Create Ansi text file from a batch script

996 views
Skip to first unread message

Harvey Colwell

unread,
Apr 1, 2002, 5:04:35 PM4/1/02
to
I'm creating a script to backup Win2k Pro system state using NTBACKUP.
You have to include a "@BKS_File_Name" on the command line. This file
simply contains the information you want to backup. In my case the
word SystemState.

I tried to create it using echo but the script would fail and NTBACKUP
would write to the Application Event Log that the BKS file was
unreadable. When I looked at a BKS file created by the NTBACKUP GUI
with a hex viewer, I noticed that all of the characters were 16 bits
(Character, NUL, Character, NUL, etc). Which I assume is Windows ANSI
format.

My script works just fine if I use a BKS file that was created by the
GUI, but I don't want my script to rely on any external files.

Does anyone know how to create an ANSI formatted text file from a
script? Maybe using a debug script?

TIA

Dean Wells

unread,
Apr 1, 2002, 5:25:23 PM4/1/02
to
It sounds as though your script is piping to the file using Unicode, if
you require 8 ANSI/ASCII style output consider using cmd /a. This can be
achieved in a variety of ways or by simply preceding each of the echo
statements with -

cmd /a /c echo blah blah >><filename>

PS - The default output of internal commands to either a pipe or a file
is (at least all my systems) ANSI so I'm wondering what's been
re-configured on yours to make this change ... not that it's difficult
... just worth a mention.

HTH

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Harvey Colwell" <HarCo...@hotmail.com> wrote in message
news:92da29ec.02040...@posting.google.com...
: I'm creating a script to backup Win2k Pro system state using NTBACKUP.

Phil Robyn

unread,
Apr 1, 2002, 5:33:12 PM4/1/02
to

Char NUL Char NUL Char NUL ... is UNICODE format.

--

u n z i p m y a d d r e s s t o s e n d e - m a i l

Dean Wells

unread,
Apr 1, 2002, 5:43:47 PM4/1/02
to
... you require 8 ANSI/ASCII style output consider using cmd ...

should read -

... you require 8 bit ANSI/ASCII style output consider using cmd ...

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"Dean Wells" <dwe...@mask.msetechnology.com> wrote in message
news:a8amok$qsoob$1...@ID-132980.news.dfncis.de...
: It sounds as though your script is piping to the file using Unicode,

:
:


Harvey Colwell

unread,
Apr 2, 2002, 12:54:29 PM4/2/02
to
Phil Robyn <pro...@uclink.berkzipeley.edu> wrote in message >

> Char NUL Char NUL Char NUL ... is UNICODE format.


Thanks everyone. It is UNICODE that I needed. I ended up creating a
script on the fly and piping it through DEBUG to create the BKS file
that I needed but by combining the info you gave here. . .

cmd /u /c echo>C:\SSbackup.BKS SystemState

is much simpler solution.

0 new messages