Skip navigation

JSI Tip 9853. What are my Network Connections names?

Using wntipcfg.exe in batch mode, I have scripted NCName.bat to return the Network Connections names for your network adapters, like Local Area Connection or JSIINC.

The syntax for using NCName.bat is:

For /f "Tokens=*" %%a in ('ncname') do (
 set name=%%a
 ...
 ...
)
NCName.bat contains:
@echo off
setlocal
set wrk="%TEMP%\WNTIPCFG_%RANDOM%.TMP"
wntipcfg /ALL /BATCH %wrk%
set key=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318\}
for /f "Tokens=1-3 Delims=: " %%u in ('type %wrk%^|find "Ethernet"^|find "adapter"') do (
 for /f "Tokens=1,2*" %%a in ('REG QUERY "%key%\%%w\Connection" /V Name^|find "REG_SZ"') do (
  @echo %%c
 )
)
del /q %wrk%
endlocal



Hide comments

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.
Publish