Description: |
call:NetworkDeviceGuid2Name guid name |
Script: |
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16.
|
:NetworkDeviceGuid2Name guid name -- gets a Network Device Name from its coresponding GUID
:: -- guid [in] - Network Device GUID
:: -- name [out,opt] - valref to return Name in
:$created 20060101 :$changed 20080219
:$source https://www.dostips.com
SETLOCAL
set guid=%~1
set key=HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}
set ret=
for /f "tokens=*" %%k in ('"reg query "%key%" /s|find /I "}\Connection" "') do (
for /f "tokens=2,*" %%m in ('"reg query "%%k" /v "Name"|findstr /b "....Name" "') do (
for /f "tokens=7 delims=\" %%g in ("%%k") do (
if "%%g"=="%guid%" set ret=%%n
)))
ENDLOCAL&if "%~2" NEQ "" (SET %~2=%ret%) ELSE ECHO.%ret%
EXIT /b
|
|