tony09uk
tony09uk

Reputation: 2991

.net core console app not runing when called from .bat file

I have created a .net core 2.0 app and can run it by using Powershell and navigating to the project folder and calling dotnet run.

If I add a .bat file containing the above command and call myFile.bat I get the error

'´╗┐dotnet' is not recognized as an internal or external command,

So I tried adding dotnet myProject.dll in the batch file and get the same error.

I have read the the two ╗┐ characters are an encoding issue, so I changed my .bat file to UTF8, but that had not effect.

What have I done wrong?

Upvotes: 1

Views: 672

Answers (1)

Michael Hancock
Michael Hancock

Reputation: 2855

Those strange characters are indeed an encoding issue, they are called Byte order marks. These are useful to programs which consume text streams, informs them of some meta information about the text that follows.

Not particularly useful for you however because the windows command prompt does not understand them. To fix this open the file up in notepad and save the file with an ANSI encoding, cmd should understand how to handle it.

The encoding setting is here

Upvotes: 3

Related Questions