0

I just change a Win7 Computer, but I found many old batch files not work in Win7.

Most serious problem is program crash/stop/error when run at comment line (I use ":" for comment). What is the comment line in Win7? Any efficient method to correct them? there are many comment in my batch file.

Besides, I have use the "pipe" to block the stdin input

command1

 echo off | command2

 command3

They work properly in WinXP, but NOT work in Win7.

SachaDee
  • 9,245
  • 3
  • 23
  • 33
user3867146
  • 63
  • 1
  • 2
  • 6
  • 3
    Maybe you should show us the batch file, which is [mcve](http://stackoverflow.com/help/mcve). – ikh Aug 22 '14 at 10:28
  • You have to use `::` or `rem` to comment a line. – SachaDee Aug 22 '14 at 10:31
  • A single colon has *never* been a comment character. It starts a label, which is something entirely different. – Harry Johnston Aug 22 '14 at 12:37
  • 1
    A line that start in double colon is _not_ a comment either. See [this post](http://stackoverflow.com/questions/16632524/what-does-double-colon-mean-in-dos-batch-files/16639875#16639875). – Aacini Aug 22 '14 at 13:38

1 Answers1

0

The correct way to write comment (or remark) in a batch file is to use the rem command.

Quoting the command's "help":

Records comments (remarks) in a batch file or CONFIG.SYS.

REM [comment]

For example:

rem This is a comment.