Environment Username

Posted on 2006-04-11
Last Modified: 2008-02-01
Does anyone know how to change the Environment Username in Windows 2000, I am trying to set it but it wont work

I used

set MyEnvironUsername = Newname
Question by:michaeljusino1017
    LVL 42

    Accepted Solution

    if you go to a cmd window and enter

    set MyEnvironUsername=GeorgeBush
    echo %MyEnvironUsername%

    You will see that it is changed.  However, you need to understand that every window has it's private copy of the environment.  So, that change will not apply to any other windows and will disappear as soon as that cmd window goes away.

    To change the environment globally, you need to go to use the environment settings.  Those settings are stored in the registry and are propogated to windows as they are opened.   I don't remember exactly how in win2000, but My Computer,  Properties or the System Control Panel should have a dialog for changing the master copy of the environment.
    LVL 44

    Assisted Solution

    by:Leigh Purvis
    Continuing on from dqmq's comments - you could perhaps use the SetEnvironmentVariable API function - to set it for the current thread.
    Private Declare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" (ByVal lpName As String, ByVal lpValue As String) As Long

    Windows launched by that instance of your application will take the setting.
    If you want it elsewhere - you'd have to use other API's to try to propagate it.

    (Or indeed as mentioned - look to set them permanently)

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now