KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q62208: Environment Variable Must Be Uppercase in ENVIRON$

Article: Q62208
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S900507-4 B_BasicCom | mspl13_basic
Last Modified: 29-JAN-1991

If "Set name=test" is entered in lowercase letters at the DOS command
line, the ENVIRON$("NAME") function returns "test" only if "name" is
in all uppercase letters in the ENVIRON$ function. If "name" is not in
uppercase letters or if it is in mixed case, a null string will be
returned. In other words, the argument to the ENVIRON$ function must
be in all uppercase letters or a null string will be returned.

This behavior occurs in Microsoft QuickBASIC versions 4.00, 4.00b, and
4.50, Microsoft BASIC Compiler versions 6.00 and 6.00b, and Microsoft
BASIC Professional Development System (PDS) versions 7.00 and 7.10 for
MS-DOS.

Program
-------

   A$= ENVIRON$("NAME")          'Don't use ENVIRON$("name")
   PRINT A$

Output
------

   test

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.