无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 5244|回复: 11
打印 上一主题 下一主题

(已解决)pe下获取本机用户名与ip、dns地址

[复制链接]
跳转到指定楼层
1#
发表于 2010-4-27 10:18:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
虽然手动可以获得,但如果有个工具会方便很多。

进PE,运行注册表编辑器regedit,加载配置单元:windows\system32\config\下的SYSTEM文件。

用户名
[HKEY_LOCAL_MACHINE\sys\SYSTEM\ControlSet001\Control\ComputerName\ComputerName]
"ComputerName"="******"

ip、dns地址:
[HKEY_LOCAL_MACHINE\sys\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces]
这个下面有几个项,其中一个里面就有


感谢dos时代菜鸟提供批处理
默认操作系统目录为C:\windows,如在其它盘请直接找到windows\system32\config\下的SYSTEM文件拖放到下面批处理上即可。

@echo off
set tempsys=%1
if %1*==* SET TEMPSYS=C:\windows\system32\config\SYSTEM
REG LOAD HKLM\TEMPSYS %tempsys%
set regx=HKLM\TEMPSYS\ControlSet001
echo 显示本地网标 >%temp%\temp.txt
for /f "tokens=3" %%c in ('reg query %regx%\Control\ComputerName\ComputerName ^| find /i "computername"') do echo %%c >>%temp%\temp.txt
echo.>>%temp%\temp.txt
echo 显示本地固定ip>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v ipaddress^|find /i "ipaddress"') do if not %%d*==0.0.0.0\0\0*  echo %%d>>%temp%\temp.txt
  )
echo.>>%temp%\temp.txt
echo 显示本地子网掩码>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v subnetmask^|find /i "subnetmask"') do if not %%d*==0.0.0.0\0\0*  echo %%d>>%temp%\temp.txt
  )
echo.>>%temp%\temp.txt
echo 显示本地默认网关>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v defaultgateway^|find /i "defaultgateway"') do if not %%d*==\0* echo %%d>>%temp%\temp.txt
  )
echo 显示本地固定dns>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v nameserver^|find /i "nameserver"') do echo %%d>>%temp%\temp.txt
  )
echo.>>%temp%\temp.txt
REG UNLOAD HKLM\TEMPSYS
cls
type %temp%\temp.txt
echo.
pause

[ 本帖最后由 xiao75918 于 2010-4-29 14:36 编辑 ]
2#
发表于 2010-4-27 17:30:37 | 只看该作者
能这样获取也好呀,如果有工具则更好,顶一下
回复

使用道具 举报

3#
发表于 2010-4-27 19:39:43 | 只看该作者
reg 命令可以挂在注册表文件。。。所以P处理可以写出来的
回复

使用道具 举报

4#
发表于 2010-4-28 08:51:33 | 只看该作者
ip、dns地址:
[HKEY_LOCAL_MACHINE\sys\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces]
这个下面有几个项,其中一个里面就



ControlSet001 你这个键值是不一定的 有的时候是 无线网卡的位置或是其他的
所以
建议使用 ipconfig /all 命令老做比较好些
回复

使用道具 举报

5#
发表于 2010-4-28 11:40:18 | 只看该作者
一般PE都不带ipconfig的。
回复

使用道具 举报

6#
 楼主| 发表于 2010-4-29 08:43:14 | 只看该作者
ipconfig/all只能反映当前系统的ip地址,而不能反映离线系统的ip,有时给一些内网用户维护安装系统,当前系统进不去了,而他不记得ip,很麻烦。所以发贴希望在pe下读取系统注册表文件来获得ip地址。
回复

使用道具 举报

7#
发表于 2010-4-29 10:09:21 | 只看该作者
我记得好像有一个命令可以显示离线系统的IP
回复

使用道具 举报

8#
发表于 2010-4-29 11:46:03 | 只看该作者
这个严重支持了 期待 ....
回复

使用道具 举报

9#
发表于 2010-4-29 12:38:00 | 只看该作者
得到本地 网标/ip/dns 的方法。大家测试一下。
把信息源文件托放到这个cmd批处理中就可以了。不托放默认信息源 :c:\WINDOWS\SYSTEM32\SYSTEM

@echo off
set tempsys=%1
if %1*==* SET TEMPSYS=
C:\windows\system32\config\SYSTEM
REG LOAD HKLM\TEMPSYS %tempsys%
set regx=HKLM\TEMPSYS\ControlSet001
echo 显示本地网标 >%temp%\temp.txt
for /f "tokens=3" %%c in ('reg query %regx%\Control\ComputerName\ComputerName ^| find /i "computername"') do echo %%c >>%temp%\temp.txt


echo 显示本地固定ip>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v ipaddress^|find /i "ipaddress"') do echo %%d>>%temp%\temp.txt
  )

echo 显示本地固定dns>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v nameserver^|find /i "nameserver"') do echo %%d>>%temp%\temp.txt
  )
cls

REG UNLOAD HKLM\TEMPSYS
type %temp%\temp.txt
pause


[ 本帖最后由 dos时代菜鸟 于 2010-4-29 13:10 编辑 ]
回复

使用道具 举报

10#
 楼主| 发表于 2010-4-29 13:19:53 | 只看该作者
如果能加一个自动搜索c、d、e盘windows\system32\config\SYSTEM文件就全自动了。

还请加一个网关吧

[ 本帖最后由 xiao75918 于 2010-4-29 13:21 编辑 ]
回复

使用道具 举报

11#
发表于 2010-4-29 13:29:15 | 只看该作者
原帖由 xiao75918 于 2010-4-29 13:19 发表
如果能加一个自动搜索c、d、e盘windows\system32\config\SYSTEM文件就全自动了。

还请加一个网关吧


1、自动搜索? 也很简单,但是个人认为还是托放比较安全通用,你可以通过“搜索”功能找出全部system 然后在搜索结果窗口依次托放。
2、增加默认网关?你就不能自己动手添加下么? 就多一个 defaultwaygate
这是增加 网关的,要在增加别的,你自己diy吧。

@echo off
set tempsys=%1
if %1*==* SET TEMPSYS=C:\windows\system32\config\SYSTEM

REG LOAD HKLM\TEMPSYS %tempsys%
set regx=HKLM\TEMPSYS\ControlSet001

echo 显示本地网标 >%temp%\temp.txt
for /f "tokens=3" %%c in ('reg query %regx%\Control\ComputerName\ComputerName ^| find /i "computername"') do echo %%c >>%temp%\temp.txt
echo.>>%temp%\temp.txt
echo 显示本地固定ip>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v ipaddress^|find /i "ipaddress"') do if not %%d*==0.0.0.0\0\0*  echo %%d>>%temp%\temp.txt
  )
echo.>>%temp%\temp.txt
echo 显示本地固定dns>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v nameserver^|find /i "nameserver"') do echo %%d>>%temp%\temp.txt
  )
echo.>>%temp%\temp.txt
echo 显示本地默认网关>>%temp%\temp.txt
for /f %%c in ('reg query %regx%\Services\Tcpip\Parameters\Interfaces') do (
   for /f "tokens=3" %%d in ('reg query %%c /v defaultgateway^|find /i "defaultgateway"') do if not %%d*==\0* echo %%d>>%temp%\temp.txt
  )

REG UNLOAD HKLM\TEMPSYS
cls
type %temp%\temp.txt
echo.
pause


[ 本帖最后由 dos时代菜鸟 于 2010-4-29 13:37 编辑 ]
回复

使用道具 举报

12#
 楼主| 发表于 2010-4-29 14:09:21 | 只看该作者
非常感谢ls
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2025-12-18 20:39

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表