开发者

Batch script Latin characters

开发者 https://www.devze.com 2023-01-14 05:05 出处:网络
I am writing a batch script to go through some directories doing an specific task, something like the following:

I am writing a batch script to go through some directories doing an specific task, something like the following:

set DBCreationScript=//Here I set the full path for the script
echo %DBCreationScript%

Problem is the path has got some latin characters (ç, ã, á) and when I run the script, the output shows strange characters, not the ones I typed in. The batch script is in ANSI encoding.

I already tried to set the script encoding to UTF-8, bu开发者_如何学JAVAt apparently the batch interpreter can't handle the control characters that appear on the beggining of the file.

Any thoughts?


Save the batch file in OEM encoding (a decent editor should allow this) or change the code page prior to running it with

chcp 1252

You can also save it as UTF-8 without signature (BOM) and use

chcp 65001

but down that path lies peril and dragons await to eat you (in short: It's usually painful and has a few weird side-effects).

0

精彩评论

暂无评论...
验证码 换一张
取 消