谷歌AI(gemini) 优化的版本,未测试,不知道能用不
[AppleScript] 纯文本查看 复制代码 @echo off 2>nul 3>nul
rem 设置变量
setlocal enabledelayedexpansion
set "Input="
set "NetworkCardsRegPath=Microsoft\Windows NT\CurrentVersion\NetworkCards"
set "NetworkConnectionsRegPath=ControlSet00%x%\Control\Network"
set "TcpipParametersRegPath=ControlSet00%x%\services\Tcpip\Parameters"
set "s=EnableDHCP NameServer IPAddress SubnetMask DefaultGateway"
set "s=%s% DHCPNameServer DHCPIPAddress DHCPSubnetMask DHCPDefaultGateway"
rem 提示用户输入系统盘符
:Input
set /p Input=输入要查询的系统安装盘符[例如D]:
if not defined Input goto Input
rem 检查系统盘符
if /i "%Input%:" neq "%systemDrive%" (
echo,系统盘符错误
exit /b 1
)
rem 获取默认网络连接索引
rem for /f "tokens=1,2*" %%a in ('reg query "HKLM\%NetworkConnectionsRegPath%\select"') do (
rem if /i "%%a" == "Default" set /a x=%%c
rem )
rem 循环遍历网卡
for /f "delims=" %%a in ('reg query "HKLM\%NetworkCardsRegPath%"') do (
if "!v:%NetworkCardsRegPath%\=!" neq "!v!" (
set /a n+=1
rem 获取网卡名称和服务名称
for /f "tokens=1,2*" %%b in ('reg query "%%a"') do (
if /i "%%b" == "ServiceName" set "Guid!n!=%%d"
else if /i "%%b" == "Description" set "NetCard!n!=%%d"
)
rem 获取 IP 地址信息
reg query "HKLM\%TcpipParametersRegPath%" /s >nul
reg query "HKLM\%TcpipParametersRegPath%\Interfaces\!Guid%%a!" >>nul
for /f "tokens=1,2*" %%b in ('reg query "HKLM\%TcpipParametersRegPath%" /s') do (
if defined flag (
for /f "tokens=1,2*" %%c in ("%%b") do (
if /i "%%c" == "Name" echo,连接名称:%%e & set "flag="
|