Problem : How can I get the user full name using a batch script?

Problem : How can I get the user full name using a batch script?

I am a bit familiar with writing batch (.bat) scripts and know how to get information like %username% for the user or racf ID or %computername% for the machine name.

How do I get the users full name. if the username is ‘jsmith’ how can I get the full name ‘John Smith’ using a batch file, sorry only know batch files? The machines are all Windows XP on a company AD domain.

I can see the full name of the user when I the START button but I want to be able to grad this info to create a folder for each user that runs the batch file to create log reports.

Solution : How can I get the user full name using a batch script?

@echo off
for /f “tokens=2*” %%a in (‘net user “%Username%” /domain ^| find /i “Full Name”‘) do set DisplayName=%%b
echo Your display name is “%DisplayName%”