You are hereBlogs / rahul's blog / "" is not recognized as an internal or external command, operable program or batch file.

"" is not recognized as an internal or external command, operable program or batch file.


rahul's picture

By rahul - Posted on 16 November 2009

Almost all of us must have encountered the following message in the Output window while getting a batch (.bat) file executed in Visual Studio as part of the build process for some project.

"" is not recognized as an internal or external command, operable program or batch file.

Atleast, I used to get (till now, when I found out its reason & eliminated it) this message randomly for my different projects. Because this message caused no harm, and the build process continued smoothly, I almost always looked over this message.

However, I recently started getting this message more commonly for my Build process batch files, and it started troubling me. I was confused because this message occured randomly, it occured for some batch files, but not for others. What confused me more was the fact that I had 2 copies of the same batch process for 2 projects, on one of them, the message appeared, and on the other, it did not.

Googling provided no solutions. With no other options, I started playing with the Encoding for the batch files used to save them.

I noticed that a new file created in VS (I have 2008) was saved with the Encoding of:

"Unicode (UTF-8 with signature) - Codepage 65001"

by default.

Changing the Encoding to:

"Western European (Windows) - Codepage 1252"

resolved the issue. So, if you are also facing the same problem, just change your Encoding for the batch file, save it & rebuild your project. the error should be gone.

Here are the precise steps you can follow:

  1. Open the file in Visual Studio
  2. Go to File->Advanced Save Options
  3. Change the Encoding to the above specified value:
    "Western European (Windows) - Codepage 1252"
    It should be the first item in the drop down list.
  4. Click Ok
  5. Save your file, and rebuild. The message should no longer be present there.

Post new comment

The content of this field is kept private and will not be shown publicly.

Mollom CAPTCHA (play audio CAPTCHA)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.