MS-DOS: Batch File Labels Are Not Case Sensitive (39627)



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

This article was previously published under Q39627

SUMMARY

The labels of batch files, which are interpreted with the MS-DOS COMMAND.COM command interpreter, are not case sensitive. For example, the following labels, as well as any other capitalization combinations, are equivalent:

:ONE
:One
:one

This is because the command processor converts all label characters to uppercase to resolve label references when it processes a batch file.

MORE INFORMATION

In the following batch file, the labels "TWO" and "Two", as well as "End" and "END" are interpreted as the same label:

if %1 == one then goto :TWO
goto END
:Two
echo One Testing.
:End

The following batch file executes the first occurrence of the label, disregarding the capitalization of that label:

@echo off
if %1 == one goto test1
goto END
:TEST1
echo Test 1
goto END
:test1
echo Test 2
:End
echo DONE!

Even though the label in the second line is lowercase, the batch file executes the first occurrence of the label. The output of the batch file, if invoked with "one" as the first parameter, would be as follows:

Test 1
DONE!


Modification Type: Major Last Reviewed: 11/26/2003
Keywords: KB39627