query Active directory display name

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
confuseis
Posts: 11
Joined: 11 Dec 2011 09:59

Re: query Active directory display name

#16 Post by confuseis » 22 Feb 2014 13:00

Below command worked, that stops me frothing at the mouth hurrah.

One thing I noted is that it didnt work running from the Bat file, then i remembered that when using variables in that context we use a double %% e.g. %%G
also to output the result to a file I appended >> full name.txt

Thanks very much everyone.


H:\>For /f "tokens=2* delims= " %%G in ('net user "%username%" /domain ^|find "Full Name"') do echo %%H >> Full-Username.txt

H:\>echo John Smith
John Smith

Post Reply