When trying to customize my command prompt I faced a strange behaviour:
from the CMD the line
SET set prompt=$D $T$H$H$H$_%USERNAME%@%COMPUTERNAME%$_$P$G
works as expected:
28/05/2020 12:02:15 [email protected] C:UsersDDS>
But if I set the same variable EDIT: (in “variable for user DDS”) with the very same values from the windows utility to set variables I got:
28/05/2020 12:04:18 [email protected] C:UsersDDS>
NOTE: the utility itself is showing the value correctly DDS when editing the variables, just the command prompt resolves
When you execute this from the system app, it is run under the SYSTEM user.
Keep in mind that the variables are not updated with every prompt. This means that if you were to change your username, your prompt does not. It becomes a static text. Given that you use prompt variables for the date, they get updated, but the computername and username are not.
I don’t think this is going to be a massive problem, but you can do 2 things to resolve this. Either not use %USERNAME% but just write out your username (it doesn’t matter anyway) or use the command prompt to set the prompt correctly, then push that to the system using:
setx PROMPT %PROMPT%
To test this, try using %CD% in your prompt, then change directory. Notice how your prompt still shows the old directory.