How to resolve "@echo" is not a recognized command

I implemented the Scott Hanselman method to support the dev / qa / prod version for web.config: http://www.hanselman.com/blog/CommentView.aspx?guid=93bfa4b3-44cd-4681-b70e-f4a2b0386466

For some reason, when I compile my project, I get this error message in the output window.
Any ideas?

------ Build started: Project: ABC.Flims.Web, Configuration: Development Any CPU ------ "C:\Projects\ballyhoo-trunk\src\ABC.Flims.Web\scripts/copyifnewer.bat" "C:\Projects\ballyhoo-trunk\src\ABC.Flims.Web\web.config.Development" "C:\Projects\ballyhoo-trunk\src\ABC.Flims.Web\web.config" 'βˆ©β•—β”@echo' is not recognized as an internal or external command, operable program or batch file. 

Here is the script file:

 @echo off echo Comparing two files: %1 with %2 if not exist %1 goto File1NotFound if not exist %2 goto File2NotFound fc %1 %2 if %ERRORLEVEL%==0 GOTO NoCopy echo Files are not the same. Copying %1 over %2 copy %1 %2 /y & goto END :NoCopy echo Files are the same. Did nothing goto END :File1NotFound echo %1 not found. goto END :File2NotFound copy %1 %2 /y goto END :END echo Done. 
+15
visual-studio-2008 visual-studio
source share
4 answers

The file is probably Unicode encoded and has a β€œOrder Mark Byte” (BOM) at the beginning, which discards the batch processor.

Save it as an ASCII file and everything will be fine. You can do this in notepad - select Save As... from the File menu and make sure the Encoding drop-down menu is set to ANSI .

+29
source share

I think your file is Unicode encoded and should be ascii.

+2
source share

A file called echo.

 P:\>echo. P:\>dir /b echo File Not Found P:\>echo echo >echo P:\>dir /b echo echo P:\>echo. 'echo.' is not recognized as an internal or external command, operable program or batch file. P:\>del echo P:\>dir /b echo File Not Found P:\>echo. P:\> 

An echo in the current folder or in the path will cause this.

/echo

+2
source share

I came across a similar problem. Found that in visual studio, if you open your * .bat file, you can select File β†’ Advanced Save Options. In the drop-down menu under the encoding, select "US-ASCII - Codepage 20127"

+1
source share

All Articles