Environment Variable Trailing Spaces Not Truncated (36605)



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 Q36605

SUMMARY

When setting environment variables, the following commands produce different environment variables:

SET FIRST=one
SET FIRST =two

MORE INFORMATION

The command SET now displays the following (along with all the other environment variables):

FIRST=one
FIRST =two

Trailing spaces are not removed from the environment variable that is being set. The variables are fully functional and may be addressed in batch files by using the same syntax when referring to the variable. For example, the following line

echo %FIRST %

will print the word "two" on the screen.

Modification Type: Major Last Reviewed: 5/12/2003
Keywords: KB36605