📎 AI Summary:
The thread discusses an issue where batch files (.bat) fail to run correctly, with error messages suggesting unrecognized commands. The original poster reports that commands like "calc" are not recognized, potentially due to unusual symbols or encoding issues. A contributor identifies that saving the batch files in UTF-8 format causes the problem, and recommends saving the files in ANSI encoding to resolve the issue.

aubycek

New Member
Member details
Joined
Feb 20, 2016
Messages
2
Thread Author #1
Hello. When I create a simple .bat file (to run calculator for example), it will give me an error saying that "filename" is not recognized as an internal or external command. I am 100% sure this happens because there are some symbols before the command "calc". When I right click my .bat file and click on edit, there is just "calc" and nothing else. When I run it, the command prompt run it as "AiLcalc" or something similar to it, so it gives me an error. What to do with this? It happens with every .bat file I try to run.
-Windows 7 64bit, latest java downloaded
-Attached screenshot of how it looks like
 

Attachments

  • Untitled.webp
    Untitled.webp
    46.8 KB · Views: 396
Solution
aubycek,

Actually I found the issue.. somehow you're saving these documents in UTF-8 format..

I made a simple document containing "ECHO Testing!" in notepad, when saving it I used the following options (note the Encoding selected):
An image from 'Command prompt/.bat files issue'. Saving a batch file with 'ECHO Testing!' in Notepad leads to a command error when run in cmd.


When executing it I get the same issue you are stating:

An image from 'Command prompt/.bat files issue'. Saving a batch file with 'ECHO Testing!' in Notepad leads to a command error when run in cmd.


So the question is, are you intentionally saving in UTF8 format? Did you start with one document that may have already been UTF8 and appended to it? Simply saving it as a normal ANSI encoded document will fix it.

Josephur

Windows Forum Admin
Staff member
Premium Supporter
Microsoft Certified Professional
Member details
Joined
Aug 3, 2010
Messages
1,283
uhm this is very strange, almost points to memory issues perhaps...

Have you tried making your batch file in another text editor?
 

aubycek

New Member
Member details
Joined
Feb 20, 2016
Messages
2
Thread Author #3
Tried now in Notepad++, same result. What do you mean by memory issues, could you be more specific please? And what could I do about it?
 

Josephur

Windows Forum Admin
Staff member
Premium Supporter
Microsoft Certified Professional
Member details
Joined
Aug 3, 2010
Messages
1,283
aubycek,

Actually I found the issue.. somehow you're saving these documents in UTF-8 format..

I made a simple document containing "ECHO Testing!" in notepad, when saving it I used the following options (note the Encoding selected):
An image from 'Command prompt/.bat files issue'. Saving a batch file with 'ECHO Testing!' in Notepad leads to a command error when run in cmd.


When executing it I get the same issue you are stating:

An image from 'Command prompt/.bat files issue'. Saving a batch file with 'ECHO Testing!' in Notepad leads to a command error when run in cmd.


So the question is, are you intentionally saving in UTF8 format? Did you start with one document that may have already been UTF8 and appended to it? Simply saving it as a normal ANSI encoded document will fix it.
 

Last edited by a moderator:
Solution