PRB: Changing Environment Variable from Within FoxPro Fails

Last reviewed: June 27, 1995
Article ID: Q90033
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

SYMPTOMS

When the RUN command is used to change an MS-DOS environment variable, the variable does not change to the new value.

CAUSE

When FoxPro starts, it creates a copy of the MS-DOS environment variables. These values cannot be changed in FoxPro because FoxPro loads a new copy of COMMAND.COM in order to process values specified in the RUN command. Any MS-DOS environment variables created or changed in this COMMAND.COM copy are valid only while that shell is running. Once the application specified in the RUN command completes its operations, the new variables or changes disappear.

RESOLUTION

Update or create MS-DOS environment variables outside FoxPro.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a GETENV()
KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral


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.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.