JSI Tip 9555. How can a script return the domains and workgroups on my network?

Using the NET VIEW command, I have scripted nwk.bat to return the NetBIOS domain and workgroup names that exist on your network.

The Syntax for using nwk.bat is:

\[call\] nwk


for /f "Tokens=*" %%w in ('nwk') do (
 @echo %%w
nwk.bat contains:
@echo off
for /f "Skip=3 Tokens=*" %%d in ('net view /DOMAIN') do (
 for /f "Tokens=1" %%x in ('@echo %%d^|FIND /V "The command"') do (
  @echo %%x

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.