In tip 7964, I scripted GetUsers.bat to retieve all the user names in a domain.

I have scripted GetLclUsers.bat to retrieve all the local user names on a computer.

The syntax for using GetLclUsers.bat is:

\[call\] GetLclUsers

The output is displayed on the console, so you could pipe it to a file, or use it for subsequent processing:

for /f "Tokens=*" %%u in ('getlclusers') do (
 call :DoSomething "%%u"
)
..
..
endlocal
goto :EOF
:DoSomething
..
..
GetLclUsers.bat contains:
@echo off
setlocal
for /f "Tokens=*" %%a in ('net user^|more +4^|find /i /v "The command completed successfully."') do (
 set line=%%a
 call :parse
)
endlocal
goto :EOF
:strip
set short=%name%#
set short=%short:  =%
set short=%short: #=#%
set short=%short:#=%
@echo %short%
goto :EOF
:parse
set name=%line:~0,25%
call :strip
set name=%line:~25,25%
if not "%name%" EQU "" call :strip
set name=%line:~50,25%
if not "%name%" EQU "" call :strip