Is there any way to modify or delete a 'user variable' on XP Pro
without login to the account?
The story is this. I got a laptop repaired but the OS (together with
defective speaker and audio board) was re-installed. The problem is the
Windows was installed with a username which I would like to replace.
Doing through Control Panel-> User Account was successful.
However, %USERPROFILE% and %HOMEPATH% still point to the wrong
folder. I managed to modify %HOMEPATH% through "Local Users and Groups"
-> Users, but %USERPROFILE% remained not pointing to the new folder
under C:\Documents and Settings. Then I decided to add USERPROFILE in
'user variable' to override the value used by XP. Now I can not login
any more through regular reboot or safe mode. I still can login as
Administrator.
How do I delete USERPROFILE that I created? From regedit, it seems I
can only access Environment Variable (user variable) defined by Current
User.
This gets complicated, as we'll see in a moment. But for now, the
answer is actually pretty clear: you can't. At least not easily, and in
any way that I would recommend.
In Windows, user names are special, and that means changing isn't as
easy as you think.
]]>
I'll cut to the chase and tell you this: it's going to be easier - much easier in fact - to simply create a new user account with the name you want. You can then choose to ignore or delete the original account (after saving or copying any data files you might want to preserve).
When a User Account is created in Windows, a whole raft of things go along with it. Things that you've seen, like the login name, are the most obvious. You've also seen the folders that get created: "C:\Documents and Settings\Username", for example, for the login name "Username".
As you've also discovered, there are what are called "environment variables" that get created so that programs can easily determine things like the location of the Documents and Settings user folder, without actually having to know which user is signed in. USERPROFILE and HOMEPATH are two such environment variables.
And we haven't even considered what all might be happening in the system registry.
So what happens when you rename a user?
Very little. In fact, a lot less than you might imagine, or hope for.
The display name changes, and that's about it.
Let's say we created a user called "Username", to build on the examples I've used so far. "Username" appears on the login screen as an option. After that user has logged in once, all the folders and environment variables and registry settings will have been set up.
Now let's rename that account (in Control Panel, Users) to be "Example User" instead. Sure enough, "Example User" shows up on the login screen. But pretty much everything else remains unchanged. "Example User" data files are still stored in "C:\Documents and Settings\Username", the environment variables for "Example User" still reference "Username".
The reality is that Windows doesn't really let you change a user name; not completely anyway. Changing a user name doesn't really change everything you think it does.
The reason is simple: to prevent things from breaking.
For example, let's say you install an application and it stores information in some user-specific location. Let's say it puts things in "C:\Documents and Settings\Username\MyStuff", and keeps a list of those path names in it's "recently used" list. If changing the username were to rename that folder, that recently used list would be completely invalid. (A recently used list is a simple example of a feature that fails after a rename, but there are other scenarios where the change could prevent an application from even starting.)
So Windows really has no choice. It lets you change the user name that's displayed, but must continue to preserve the folders and settings that were created under the original name. And as you've seen, it'll get kind of insistent about things like the environment variables.
My recommendation: live with it. Change the user name if you like, but live with the fact that the folder names will not change.
My alternate recommendation: create a new user account with the name you want and copy your settings and data. Then, after you're sure you no longer need it you can delete the old name/account.
That’s what I would have suggested but I would add one warning. If you create a new user and move over all the files from My Documents you will still have a lot of files in the Application Data and Local Settings folders which are easy to move but not necessarily easy to find which you wouldn’t want to lose such as stored emails, address books, browser bookmarks and more. So unless you know how to find and copy those you might want to put up with that not so desirable name on your folders.
Another consideration is encryption: if you have encrypted files XP will have generated keys based on the user. Copying them to a new user requires care!
Those are the Simple solutions…
However, he was getting to a solution to rename the variables (*though i have no idea how stable things will be after that, and i would not recommend it*) but as he found out, Windows stores separate registries for User and System. The User registry is located in %userprofile%\NTUSER.DAT and the System registries are in %systemroot%\system32\config under the names SOFTWARE, SYSTEM, DEFAULT, SAM, and SECURITY. You can read and edit these files using a registry hive tool. A Google search of “registry hive editor” should be enough to find dozens of such programs. Some are free, some are not.