Jump to content

custom CMD Prompt (through registry)


fortwunty

Recommended Posts

Okay, I know the registry key per-user is HKCU\Environment\Prompt to set the prompt value, but how would I go about actually setting a per-user prompt? I tried this... at T-12, in one of my .cmd files being called, this launches:

REG ADD "HKCU\Environment" /v "PROMPT" /t REG_EXPAND_SZ /d "$C%USERNAME%$F$S$P$G" /f

For this sort of output:

(username) C:\WINDOWS\system32

Now, when I launch that at the T-12 stage, I don't think %USERNAME% is being evaluated at all, because I get () C:\WINDOWS\system32. The users are created in the .cmd file right before this one.

Would I be better off setting a global prompt? Or should I add something to RunOnceEx to just force this in there?

Link to comment
Share on other sites


%username% is evaluated once at the moment you launch the command line (and is not written in the registry).

If you escape the percents (^%username^%), it will write %username% in the registry, but it will not evaluate it before displaying the prompt.

Thus, to get the prompt you expect, you need to set each user's PROMPT var with the real username in. A good way to do that is by running it on the first user logon.

++

Link to comment
Share on other sites

After setting up users, do it

http://unattended.msfn.org/unattended.xp/view/web/27/

If you use net user blahblahblah /add method, in [Guirunonce] of winnt.sif, you can put "%path%\batch.cmd" and of course, in batch.cmd, you have "REG ADD "HKCU\Environment" /v "PROMPT" /t REG_EXPAND_SZ /d "$C%USERNAME%$F$S$P$G" /f"

Then it will onyl apply to user blahblahblah.

Sorry if this doesn't help, I don't fully understand.

Link to comment
Share on other sites

Sorry if this doesn't help, I don't fully understand.

This was exactly what I needed... and I had tried something almost exactly like this, but forgot something and it went to hell. Thanks for the help. Only problems I'm having trouble with now is the %USERPROFILE% being recognized from a .cmd called from RunOnceEx. Big thanks though.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...