Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Environment Username

Posted on 2006-04-11
2
Medium Priority
?
634 Views
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
0
Comment
Question by:michaeljusino1017
2 Comments
 
LVL 42

Accepted Solution

by:
dqmq earned 1000 total points
ID: 16432351
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.
0
 
LVL 44

Assisted Solution

by:Leigh Purvis
Leigh Purvis earned 1000 total points
ID: 16432976
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)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

580 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