csx 发表于 2024-3-11 04:27

系统崩了进不去系统进入PE系统查看IP脚本

单位个人电脑操作系统崩了,无法进入系统查找设置的IP地址,找了个批处理,在进入WinPE后可以使用找回,需要的自取。
不是原创哈。

https://www.lanzoub.com/iofmD1pvjsid
密码:ahgs

csx 发表于 2024-3-11 04:48

谷歌AI(gemini) 优化的版本,未测试,不知道能用不


@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="


页: [1]
查看完整版本: 系统崩了进不去系统进入PE系统查看IP脚本