Skip navigation

JSI Tip 5458. How do I retrieve the user's full name in a logon script?


If you require the users full name in a domain logon script, include the following command in your script:

for /f "Tokens=2*" %%m in ('net user %USERNAME% /domain ^| find "Full Name"' ) do set fname=%%n
The users full name will be set into the fname environment variable.

To use the fname environment variable, see the following example:

@echo Welcome %fname%.

If you require the users full name in a local logon script, include the following command:

for /f "Tokens=2*" %%m in ('net user %USERNAME% ^| find "Full Name"' ) do set fname=%%n


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish