Question: On Windows XP in an Active directory environment - what is the easiest way for me to query a user's email address from AD given their username on the command line. 

(Assuming I know where it is kept normally in tree). 

(I know about net user *loginname* /domain but I just want the email address element back.)

Answer: 
something like this dsquery might work.

query email by username
dsquery.exe \* -filter "(&(objectClass=user)(!(objectClass=computer)(sAMAccountName=username)))" | dsget user -email

I misread the post first and thought you wanted user name from email name. That's why i posted this one.
dsquery.exe \* -filter "(&(objectClass=user)(!(objectClass=computer)(mail=user@domain.com)))" -attr username

based on some scripts at work and this site which has some other ideas <http://www.petri.co.il/forums/showthread.php?t=18464> about using csvde.exe
You can write simple VBScript to query thru LDAP
Create a file with VBS extension

Put inside something like this

```
On Error Resume Next
Set objUser = GetObject _
  ("LDAP://CN=USER NAME,DC=DOMAIN_NAME,DC=com")

objUser.GetInfo

strMail = objUser.Get("mail")

WScript.echo "mail: " & strMail 

```

Put correct USER NAME into LDAP query string, run VBS file and enjoy :)

If it is your first time you work with LDAP, it could be a little bit complicated to write LDAP query
In order to recognize the LDAP path to the user (i.e. what you need to put after LDAP://) you may download [Active Directory Explorer](http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx) from Microsoft
Run explorer, navigate to the user and see what it shows in the Path text box

In my case it was something like
CN=[user name],CN=Users,DC=[city\_name],DC=[company\_name],DC=com,