On 2012-07-24 21:06, JJ wrote:
> Thaks, it solves my problem although it's not for checking the
> Unicode mode.
I don't think there is any Registry or any system setting that can be
examined. It is an internal CMD setting and there is no console command
that exposes this setting.
> Do CMD in Vista and Windows 7 still run in ANSI mode as default
> mode?
How do we know? I think the only way you can determine which mode the
script's CMD is in is to pipe some Unicode into something else and
examine what has been received. I don't know which internal commands to
do this with, where to get guaranteed Unicode output from, and how to
examine the received text. The examination would probably require
writing a file and looking for 00 with FC.
The default might be language dependent so I think you are better off
making this test every time, if you can find out how to make the test.
If you can't, or if the test is awkward, and you don't need to retain
environment variables, then it is probably best to CMD/U your script
each time. Since the test would probably require writing temporary files
then if you need to retain environment variables you could write them
into a file and read them into the parent CMD's environment.
Is there someone with CMD/U experience willing to develop a procedure?
Frank