Extracting Network Profiles and displaying only Network Profile description in txt file

前端 未结 2 771
栀梦
栀梦 2021-01-15 17:37

I am very new to batch scripting and have to use console to interrogate Registry for network profile description and output only the description data to a txt file. I am usi

2条回答
  •  走了就别回头了
    2021-01-15 18:04

    Here is an quick example which should output a file providing each GUID and Description alongside your running script.

    @Echo Off
    SetLocal EnableExtensions DisableDelayedExpansion
    (Set k=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles)
    For /F "Delims==" %%A In ('Set GUID[ 2^>Nul') Do Set "%%A="
    Set "i=101"
    For /F "EOL=E Tokens=1,2*" %%A In ('Reg Query "%k%" /S /V Description') Do (
        If "%%~nB" NEq "%%~B" (Call Set "GUID[%%i:*1=%%]=%%~nB") Else (
            Call Call Set GUID[%%i:*1=%%]="%%%%GUID[%%i:*1=%%]%%%%","%%C"
            Set/A i+=1))
    If %i% NEq 101 (>"%~dp0NetProfs.log" 2>Nul Set GUID[)
    EndLocal
    Exit/B
    

    You will probably need to right-click and run as Administrator due to resrictions on those keys.

提交回复
热议问题