Cannot Use %Username% as a System Variable in Windows

ID: Q227180


The information in this article applies to:
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Professional


SUMMARY

You cannot use %username% as a System Environment Variable parameter in Windows 2000.


MORE INFORMATION

Windows 2000 does not return the user name if you configure the System Environment Variable to use the following parameter:

%username%
Windows returns the value %username% instead of the user name that was used to log on to the computer.

NOTE: Using this parameter in Microsoft Windows NT 4.0 and 3.51 returns the user name that is currently logged on.

To change the System Environment Variable, follow these steps:
  1. Right-click My Computer.


  2. Click Properties.


  3. On the Advanced tab, click Environment Variables.


  4. Under System Variables, click Logname, and then click Edit.


  5. In the Variable Value box, type the user name for that computer.


The variable %username% does not exist in a system context. When the session manager creates the system environment variables, the only variables available to use are %SystemDrive% and %SystemRoot%.

Additional query words:

Keywords : kbenv kbtool
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: December 29, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.