Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using the net view command. It displays the users on the network in big and ugly UPPERCASE letters and has columns etc., for example:

Server Name            Remark    
-------------------------------------------------------------------------------
\\ADRIAN-PC
\\MARK-PC

The command completed successfully.

Is there a way for me just to display the computer names on the network?

-Adrian
-Mark

I'd like to have the output without the lines and columns. Maybe with a findstr command.

share|improve this question
6  
What do you need that for? Notice that not all computers will have names like SOMEONE'S-PC. –  gronostaj Mar 24 '13 at 17:19
add comment

2 Answers

(for /f %a in ('net view ^| findstr/b \\\\') do @echo %a)

You cannot (or should not) remove the -PC suffix, since you are not listing usernames – you are listing computer names, and the suffix is part of the computer name.

share|improve this answer
    
Sorry We South Africans spell "welldone" with 2 L's. Thanks for the code I'll test it out now! :) –  Adrianvdh Mar 24 '13 at 18:28
    
So would it work if I had 5 users on the network? –  Adrianvdh Mar 24 '13 at 18:37
    
And is it possible for me to save it into a varible i.e for /f %%i in ('net view^|findstr /b \\') do set networkuser=%%i –  Adrianvdh Mar 24 '13 at 18:44
    
Or if there are no users on the network. echo NO USERS FOUND –  Adrianvdh Mar 24 '13 at 19:21
1  
It doesn't list users. It lists computers. –  grawity Mar 24 '13 at 20:00
add comment

Net View displays domain/workgroup resources, i.e server and PC resources. It doesn’t give an accurate overview of machines on the network as that’s not it’s complete role. You need to use ARP –a to get this and translate them to their hostnames.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.