ok this is my code so far
@echo off
echo enter user:
set /p user=
net user %user%
pause
now i need to copy the line that says last logon. this line comes up when you do the net user command.
i used to know how to do this but ive forgot. i think it invloved using the copy command of some sort.
copy.....net user. i really dont know please help thanks.
Last logon
Moderator: DosItHelp
Re: Last logon
You could use a FOR /F loop.
Regards
aGerman
Code: Select all
@echo off
set /p "user=enter user: "
for /f "delims=" %%a in ('net user %user%^|findstr /i /c:"last logon"') do set "lineLastLogon=%%a"
:: your stuff here, eg.:
echo %lineLastLogon%
pause
Regards
aGerman