Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think I ran across a bug in a batch file because it was written with unix line endings. Is this a known problem with cmd.exe running batch files in windows?

share|improve this question
I have never had a problem, and I always use unix line endings. But that doesn't mean that there isn't some problem I have just been lucky enough to miss. – Zoredache Sep 18 '12 at 19:19
Which bug did you run into? Commands failing to start? Or just that it looked as if there are not line endings when you open the file with notepad? – Hennes Sep 18 '12 at 19:21
up vote 5 down vote accepted

This really isn't a "bug"... as it is by-design. Windows new-lines are defined as "\r\n" ... or a "Carriage Return" and "New Line" combination... whereas *nix flavors prefer omitting the carriage return. You should always use "\r\n" in anything in Windows where possible. Anything else may be interpreted incorrectly... and cause a great deal of unexpected results.

share|improve this answer
I came across an issue where call :label didn't jump to a label, but the same call later on the file did jump to the label. The file in question was using \n line endings. I switched to \r\n line endings for all batch files in my project and the problem was gone. I didn't re-test with \n endings to confirm it wasn't just a one-time fluke (the scripts takes nearly an hour to run). – Samuel Jun 19 '15 at 22:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.