To produce a list of user logon names in your domain, you could use
tip 3410, but if
all you want is user logon name, with trailing spaces removed, you could use
UserList.bat.
The usage syntax is:
UserList <FullPathToOutputFile>
Example:
UserList C:\TEMP\UserList.txt
UserList.bat contains:
@echo off setlocal if \{%1\}==\{\} goto syntax set file=%1 if exist %file% del /q %file% for /f "Skip=4 Tokens=*" %%i in ('net user /domain^|findstr /v /c:"----"^|findstr /v /i /c:"The command completed"') do ( set line=%%i call :parse ) endlocal goto :EOF :syntax @echo Syntax UserList OutputFileName endlocal goto :EOF :strip set short=%name%# set short=%short: =% set short=%short: #=#% set short=%short:#=% @echo %short%>>%file% 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
0 comments
Hide comments