Total Pageviews

2014/03/31

Bat(Batch) script 執行出現出現中文亂碼問題

Problem
I edit a batch script which be used to set IP address
netsh interface ipv4 set address name="區域連線" source=static address=10.144.38.195 mask=255.255.255.0 gateway=10.144.38.254 

But when I execute this batch script in command prompt, it seems that the Traditional Chinese characters are broken.
C:\Users\albert\Desktop>netsh interface ipv4 set address name="?€?€??" source=static address=10.14  
 4.38.195 mask=255.255.255.0 gateway=10.144.38.254  
 檔案名稱、目錄名稱或磁碟區標籤語法錯誤。  

Solution
This problem results from the encoding of the batch script file. You need to change its encoding from UTF-8 to ANSI.

Reference
[1] http://www.bathome.net/viewthread.php?tid=24088

No comments: