中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-03 08:20
48,038 topics / 350,123 posts / today 0 new / 48,251 members
DOS批处理 & 脚本技术(批处理室) » Errors when running a batch file
Printable Version  734 / 3
Floor1 kawaguchi Posted 2007-01-30 19:41
初级用户 Posts 32 Credits 67 From 日本の江户
I casually wrote a batch file, but when I run it I get this result,
could one of the experts help explain it?
I would be extremely grateful, little brother here~~~


──────────────── Moderator record ────────────────
Action taken by: namejm
Original title: Please help, experts
Note: Because the title description is too vague, it is inconvenient for forum searching and management, please modify the title within three days.
Tip: To modify the title, click
Edit, at the lower right of the current post, and after modifying it press Edit Post .
Penalty: Since you have only recently left the new-user stage of the forum, no penalty will be given for now; if the title is still not modified after three days,
  2 credits will be deducted as punishment, and the moderator will forcibly modify the title. Please click
here to read the forum posting rules,
  so as to avoid violating the rules in future discussions.
──────────────── Moderator record ────────────────


[ Last edited by kawaguchi on 2007-1-31 at 05:13 PM ]

Attachments
1.JPG (8.67 KiB)
2.JPG (19.94 KiB)
Floor2 redtek Posted 2007-01-30 21:22
金牌会员 Posts 1,147 Credits 2,902
When you finished writing the batch commands and then saved the file, you mistakenly saved it as a text file encoded in UTF-8, and that caused the above error~:)


I suggest you just save the batch file as: ANSI format~:)
Please do not use Unicode or other non-ANSI formats to save batch files.



When a file is encoded or stored in UTF-8 format, the beginning of the batch file will have a marker:


0B3E:0100 EF BB BF 40 65 63 68 6F-20 6F 66 66 0D 0A 64 69 ...@echo off..di


The red-marked part above is the special UTF-8 marker, which cannot be seen in Windows Notepad. But when reading this text with the Type command, it can be seen. It is what caused the error message when your batch file was running (an error occurred; the system treats it as not being a command:)



When the file is encoded in standard ANSI format, there is no special marker at the file header:


0B3E:0100 40 65 63 68 6F 20 6F 66-66 0D 0A 66 0D 0A 64 69 @echo off..f..di

 
 
 
 
 
 

【 Full-text search keywords: garbled text UTF-8 encoding ANSI 】

[ Last edited by redtek on 2007-1-30 at 11:13 AM ]
Floor3 zhangyzy Posted 2007-01-30 21:33
新手上路 Posts 6 Credits 12
Learning
Floor4 kawaguchi Posted 2007-01-30 23:36
初级用户 Posts 32 Credits 67 From 日本の江户
Many thanks to redtek for the detailed explanation~~
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023