Windows Terminal incorrectly shows user SYSTEM not the actual Username? (Incorrect %USERNAME% in PROMPT) #15977

Open
opened 2026-01-31 04:53:54 +00:00 by claunia · 0 comments
Owner

Originally created by @tDwtp on GitHub (Nov 26, 2021).

I've tried to set up my terminal to look a little different. ($E[1;32m%USERNAME%@%COMPUTERNAME%$E[0;37m:$E[33m$+$E[1;34m$P$E[0;37m$$ $E[0m to be exact.) I edited the PROMPT and noticed in order to let the username show up I had to use the registry.

In the classical CMD.EXE it looks as expected, but for a while now I am using Windows Terminal.
And here are the results:

Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. Alle Rechte vorbehalten.

SYSTEM@HOME:C:\Users\tDwtp$ REG QUERY HKCU\Environment /F PROMPT /T REG_EXPAND_SZ

HKEY_CURRENT_USER\Environment
    PROMPT    REG_EXPAND_SZ    $E[1;32m%USERNAME%@%COMPUTERNAME%$E[0;37m:$E[33m$+$E[1;34m$P$E[0;37m$$ $E[0m

Suchvorgang abgeschlossen: 1 übereinstimmende Zeichenfolge(n) gefunden.

SYSTEM@HOME:C:\Users\tDwtp$ SET PROMPT
PROMPT=$E[1;32mSYSTEM@HOME$E[0;37m:$E[33m$+$E[1;34m$P$E[0;37m$$ $E[0m

SYSTEM@HOME:C:\Users\tDwtp$ whoami
home\tdwtp

SYSTEM@HOME:C:\Users\tDwtp$ 

As you can see, it shows SYSTEM as the user. Kinda funny, but also a little discomforting. The last time I started up a console as SYSTEM was on Windows XP.

The PROMPT broken down: (explanation of ANSI Escape Codes here)

String Description
$E[1;32m set the color to bright green
%USERNAME% @ %COMPUTERNAME% show <user>@<host>
(%USERNAME% is the problem here)
$E[0;37m : show a (dark-)white colon :
$E[33m $+ show how many directories are pushed via PUSHD in (still dark-)yellow
$E[1;34m $P show the current path in a (light-)blue
$E[0;37m $$ show a (dark-)white dollar sign $
$E[0m revert back to a dark-white color for text. (COLOR will not work with this!)
Originally created by @tDwtp on GitHub (Nov 26, 2021). I've tried to set up my terminal to look a little different. (`$E[1;32m%USERNAME%@%COMPUTERNAME%$E[0;37m:$E[33m$+$E[1;34m$P$E[0;37m$$ $E[0m` to be exact.) I edited the `PROMPT` and noticed in order to let the username show up I had to use the registry. In the classical `CMD.EXE` it looks as expected, but for a while now I am using Windows Terminal. And here are the results: ``` Microsoft Windows [Version 10.0.19043.1348] (c) Microsoft Corporation. Alle Rechte vorbehalten. SYSTEM@HOME:C:\Users\tDwtp$ REG QUERY HKCU\Environment /F PROMPT /T REG_EXPAND_SZ HKEY_CURRENT_USER\Environment PROMPT REG_EXPAND_SZ $E[1;32m%USERNAME%@%COMPUTERNAME%$E[0;37m:$E[33m$+$E[1;34m$P$E[0;37m$$ $E[0m Suchvorgang abgeschlossen: 1 übereinstimmende Zeichenfolge(n) gefunden. SYSTEM@HOME:C:\Users\tDwtp$ SET PROMPT PROMPT=$E[1;32mSYSTEM@HOME$E[0;37m:$E[33m$+$E[1;34m$P$E[0;37m$$ $E[0m SYSTEM@HOME:C:\Users\tDwtp$ whoami home\tdwtp SYSTEM@HOME:C:\Users\tDwtp$ ``` As you can see, it shows SYSTEM as the user. Kinda funny, but also a little discomforting. The last time I started up a console as SYSTEM was on Windows XP. The PROMPT broken down: ([explanation of ANSI Escape Codes here](https://en.wikipedia.org/wiki/ANSI_escape_code)) | String | Description | |:------ |:----------- | | `$E[1;32m` | set the color to bright green | | `%USERNAME%` `@` `%COMPUTERNAME%` | show *&lt;user&gt;@&lt;host&gt;*<br/>(`%USERNAME%` is the problem here) | | `$E[0;37m` `:` | show a (dark-)white *colon* `:` | | `$E[33m` `$+`| show *how many directories are pushed via `PUSHD`* in (still dark-)yellow | | `$E[1;34m` `$P` | show the *current path* in a (light-)blue | | `$E[0;37m` `$$ ` | show a (dark-)white *dollar sign* `$` | | `$E[0m` | revert back to a dark-white color for text. (`COLOR` will not work with this!) |
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 04:53:54 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15977