The registry key locations for the PC username and PC hostname in Windows XP are as follows:
PC Username:
To retrieve the currently logged on username, you can access it dynamically through the environment variables using %USERNAME%.
If you are looking for the username stored in the registry, you won't find it under HKEY_LOCAL_MACHINE. The currently logged-on user information is typically stored under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList.
PC Hostname:
To find the hostname, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname.
The hostname is under HostName in the registry key...
The registry key locations for the PC username and PC hostname in Windows XP are as follows:
PC Username:
To retrieve the currently logged on username, you can access it dynamically through the environment variables using %USERNAME%.
If you are looking for the username stored in the registry, you won't find it under HKEY_LOCAL_MACHINE. The currently logged-on user information is typically stored under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList.
PC Hostname:
To find the hostname, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname.
The hostname is under HostName in the registry key path mentioned above. The correct syntax to retrieve these keys would vary depending on how you want to access this information. If you are looking to dynamically read the PC username or hostname, using %USERNAME% or %COMPUTERNAME% environment variables in a script or command prompt would be preferable. If you need to access this information directly from the registry, you can use command line utilities like REG QUERY to get the values stored in the Windows registry. An example would be: