China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-03 07:22
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Errors when running a batch file View 733 Replies 3
Original Poster Posted 2007-01-30 19:41 ·  中国 湖北 孝感 电信
初级用户
Credits 67
Posts 32
Joined 2007-01-25 18:14
19-year member
UID 77654
Gender Male
From 日本の江户
Status Offline
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
2.JPG
打尽天下不平事,为抱国家尽我心!
Floor 2 Posted 2007-01-30 21:22 ·  中国 北京 朝阳区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
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 ]
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 3 Posted 2007-01-30 21:33 ·  中国 山东 联通
新手上路
Credits 12
Posts 6
Joined 2006-12-21 04:25
19-year member
UID 74106
Gender Male
Status Offline
Learning
Floor 4 Posted 2007-01-30 23:36 ·  中国 湖北 孝感 电信
初级用户
Credits 67
Posts 32
Joined 2007-01-25 18:14
19-year member
UID 77654
Gender Male
From 日本の江户
Status Offline
Many thanks to redtek for the detailed explanation~~
打尽天下不平事,为抱国家尽我心!
Forum Jump: