I've a strange problem that I have never seen before in my ~30 years of working with batch files. Given a dummy CMD file such as this:
@echo off
:somelabel
echo Testing something
dir /b
echo All is well.
:end
This mostly runs as expected, but sometimes I get output such as 'ing something' is not recognized as an internal or external command, operable program or batch file.
That's clearly an occurrence where it has chopped off a bit of a line and attempted to execute the rest of it. When this happens, it's always a 'random' fraction of a 'random' line; it's not always line X, or losing Y characters, or occurring where I have a particular character combination. Nor does it affect only echo
statements, it could just as well try to execute abel
or ir /b
.
My system is a fully updated Win2008 R2, running in VirtualBox 5.0.2, running in a fully upgraded Linux Mint, running on a Lenovo ThinkPad. The scripts are all UTF-8 encoded.
... what's going on? How can I avoid this?