Ever get strange characters ( ╗┐’ )when executing a PS1 or batch file?

I’ve had this happen a few times, and always wondered what was up.

Every once in a while, I’d try to run a powershell file that looked normal in my text editor, but when I ran it, would have a few extra characters in front.

This often surfaced when calling one powershell/batch file from another.

Today I copied the odd characters off the screen and searched for them on the internet.

I found this great blog post.

http://superuser.com/questions/601282/%CC%81%E2%95%97%E2%94%90-is-not-recognized-as-an-internal-or-external-command

Basically those 3 characters I was getting were “Beginning of File” characters -something some formats handle better than others.

The solution was simple – I went into Notepad++ and changed the file encoding to “UTF-8 no BOF” and then used the convert option right under that in the menu for good measure.

Problem solved, and more importantly, I understand now why it was happening.

Leave a Reply