Redirection Disables REM in Batch Files (26281)



The information in this article applies to:
    Microsoft MS-DOS operating system 3.1
    Microsoft MS-DOS operating system 3.2
    Microsoft MS-DOS operating system 3.21
    Microsoft MS-DOS operating system 3.3
    Microsoft MS-DOS operating system 3.3a
    Microsoft MS-DOS operating system 4.0
    Microsoft MS-DOS operating system 4.01
    Microsoft MS-DOS operating system 5.0
    Microsoft MS-DOS operating system 5.0a
    Microsoft MS-DOS operating system 6.0
    Microsoft MS-DOS operating system 6.2
    Microsoft MS-DOS operating system 6.21
    Microsoft MS-DOS operating system 6.22

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).

Modification Type: Major Last Reviewed: 5/10/2003
Keywords: KB26281