Microsoft KB Archive/26281

From BetaArchive Wiki
Knowledge Base


Redirection Disables REM in Batch Files

Article ID: 26281

Article Last Modified on 5/10/2003



APPLIES TO

  • Microsoft MS-DOS 3.1
  • Microsoft MS-DOS 3.2 Standard Edition
  • Microsoft MS-DOS 3.21 Standard Edition
  • Microsoft MS-DOS 3.3 Standard Edition
  • Microsoft MS-DOS 3.3a
  • Microsoft MS-DOS 4.0 Standard Edition
  • Microsoft MS-DOS 4.01 Standard Edition
  • Microsoft MS-DOS 5.0 Standard Edition
  • Microsoft MS-DOS 5.0a
  • Microsoft MS-DOS 6.0 Standard Edition
  • Microsoft MS-DOS 6.2 Standard Edition
  • Microsoft MS-DOS 6.21 Standard Edition
  • Microsoft MS-DOS 6.22 Standard Edition



This article was previously published under Q26281

In Microsoft MS-DOS versions 3.2 and later, redirection has higher priority than the REM command. For example, the following batch file causes the file test to contain either "BBBBB" or zero bytes after the REM statement, depending on which version of MS-DOS your are using. In other words, the redirection symbol is not disabled by the REM statement.

   echo AAAAA > test
   type test
   REM echo BBBBB test > test
   type test
        

Even if you comment out the redirection with a REM statement, it still occurs, nullifying the file (because the REM command ensures that nothing would be redirected into the file).


Additional query words: 6.22 3.2 3.21, 4.x 5.x 6.00 6.20

Keywords: KB26281