Software >> OS >> Windows >> Command LIne >> How to use FOR loop and wmic to get last logon information of all users

 

 

for /F "tokens=1 skip=1" %a in ('wmic useraccount get name ^| findstr /r /v "^$"') do @echo %a & @net user %a | findstr /R "Last logon"

Note: the above command enter in a single line.