Hello
New user here.
I am trying to get a clean output from net user /domain command. I want to get each user in a separate line rather than columns. but I was unable to get users pass the first column.
I did a little research and came upon this.
But the solutions posted here also don't seem to work. besides that they print the extra lines that command produces(which I can remove by using findstr /v but have to create several temp files) they don't print out all the users.
How can I print all the users in a separate lines? I think I must use for/f but I am not that familiar with it. any explanation would be greatly helpful.
Clean the net user output command
Moderator: DosItHelp
Re: Clean the net user output command
test-1.bat
Code: Select all
@echo off
set "Ignore1=The command completed successfully."
for /f "skip=4 tokens=1-3" %%a in ('net user ^| findstr /v /i /c:"%Ignore1%"') do (
if "%%a" neq "" (
echo,%%a
if "%%b" neq "" (
echo,%%b
if "%%c" neq "" (
echo,%%c
)
)
)
)
pause
Re: Clean the net user output command
Thanks
Works like a charm
Sorry for late replay, site had some problems for me.
Works like a charm
Sorry for late replay, site had some problems for me.