Now I have to extract the users full name to put in the signature file. Which seemed pretty easy:
Code: Select all
net user %username% /domain | findstr /C:"full name" /i
Code: Select all
for /f "tokens=3*" %%G in ('net user %username% /domain ^| findstr /C:"full name" /i') do echo %%G
Reading the part on For /F it says "Each token specified will cause a corresponding parameter letter to be allocated." I thought the * would assign the whole line to a single variable, and when tried, like 'tokens=*', it does echo the complete line. But if I specify 'tokens=3*' it only returns the third token. Now if I modify the line to:
Code: Select all
for /f "tokens=3*" %%G in ('net user %username% /domain ^| findstr /C:"full name" /i') do echo %%G %%H %%I %%J
As a work-around, I made some changes and added an extra line to extract the full name:
Code: Select all
for /f "tokens=*" %%G in ('net user %username% /domain ^| findstr /C:"full name" /i') do set name=%%G
SET _result=%name:~41%
ECHO %_result%