Link to home
Start Free TrialLog in
Avatar of fireburn11
fireburn11

asked on

batch script to full use's last name based on sam id

Hi All,

I have this script to read in text file that contains list of user's logon name, then I want it to give me user's firstname and lastname based on it. But it keeps telling me"%%L" is unexpected at this time.

Could someone look at this and tell me what is wrong? Thanks

Cfor /f %%L in (c:\test.txt) do dsquery user -samid %%L | dsget user -ln
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fireburn11
fireburn11

ASKER

That did the trick, i didn't know you can only use one "%" when you run in cmd.exe.

Thanks for the help!
No problem, yup just one of those gotchas!