If by "ID" you mean the number in the first column, be careful about
treating it as if it were a number; the leading zero will flag it as an
octal number, in which case 08 and 09 will result in errors.
/Al
"Jeffery Hicks [MVP]" <jhicks@sapien.com> wrote in message
news:8F5155A0-9AB1-43E4-922C-5E11A8A30675@microsoft.com...
> Try something like this:
>
> FOR /F "tokens=1" %x in ('find /i "userb" users.txt') do @set zuser=%x
>
> If you use this in a batch file change %x to %%x.
>
> --
> Jeffery Hicks
> Microsoft PowerShell MVP
> http://www.scriptinganswers.com
> http://www.powershellcommunity.org
>
> Now Available: WSH and VBScript Core: TFM
> Coming Soon: Windows PowerShell: TFM 2nd Ed.
> "abs" <nospam@wp.pl> wrote in message news:fh166n$phk$1@inews.gazeta.pl...
>> Hi everyone.
>>
>> This is how my file containing list of users looks like (id username):
>>
>> 01 UserA
>> 02 UserB
>> 03 UserC
>> ...
>>
>> I'm trying to write a batch file which could read the id of user whose
>> name
>> is passed as a parameter and save it to variable. I can find the line
>> containing user's name:
>>
>> find "%1" UserB userlist.txt
>>
>> but how to save just user's id to variable ?
>>
>> Best regards,
>> ABS
>>
>>
>>
>