[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
我照着楼上的弄了一个 bat 怎么重视查找不到~~计算机名称和ip地址呀
下面是我的bat文件内容~~~大虾们帮我看看是哪出了问题呀
能查出MAC 就是查不出其他信息。


@echo off
set MASK=255.255.255.0
set GATEWAY=192.168.1.1
set DNS=192.168.1.1
echo.
echo.            完成获取资料,请检查正确后按确认键开始执行修改任务
echo.*************************************************************************
echo.
for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%i
echo.        本机 MAC地址 (硬件获取):       %Mac%
for /f "tokens=1,2*" %%i in ('ipconfig /all^|find "Ethernet adapter"')  do set Ethernet=%%k
echo         本机计算机名 (动态获取):        %pcname%
for /f "tokens=1,2" %%i in ('more /e +13 %0 ^|find /i "%mac:~,-1%"') do set "name=%%i"&set "IP=%%j"
echo         本机 IP 地址 (动态获取):        %myip%
echo.
echo.*************************************************************************
echo         子网掩码 (静态获取):        %mask%
echo         本机网关 (静态获取):        %gateway%
echo.        本机DNS (静态获取):        %DNS%
echo.
pause
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d %name% /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d %name% /f >nul 2>nul
netsh interface ip set address "%Ethernet:~,-2%" static %IP% %Mask% %GATEWAY% 1 >nul 2>nul
netsh interface ip set dns "%Ethernet:~,-2%" static %DNS% >nul 2>nul
pause&exit
s0101 192.168.1.101 00:E0:A0:1D:0C:C2
s0102 192.168.1.102 00:E0:81:08:41:7C
s0103 192.168.1.103 00:E0:81:03:9F:FB
s0104 192.168.1.104 00:E0:81:08:32:B7
s0105 192.168.1.105 00:E0:A0:1D:0C:E0
s0106 192.168.1.106 00:E0:81:03:6D:6A
s0107 192.168.1.107 00:E0:81:07:F6:68
s0108 192.168.1.108 00:E0:81:08:69:E7
s0109 192.168.1.109 00:E0:81:03:CA:1A
s0110 192.168.1.110 00:E0:81:08:3B:F9
s0111 192.168.1.111 00:E0:81:08:30:95
s0112 192.168.1.112 00:E0:81:07:78:43
s0113 192.168.1.113 00:E0:A0:1C:B0:88
s0114 192.168.1.114 00:E0:81:07:E9:11
s0115 192.168.1.115 00:E0:81:07:F2:C5
s0116 192.168.1.116 00:E0:81:08:5C:F5
s0117 192.168.1.117 00:E0:81:03:A7:62
s0118 192.168.1.118 00:E0:A0:1C:B3:F4
s0119 192.168.1.119 00:E0:A0:1C:EA:4E
s0120 192.168.1.120 00:E0:81:08:67:36
s0121 192.168.1.121 00:E0:A0:1C:B3:F9
s0122 192.168.1.122 00:E0:81:03:9F:25
s0123 192.168.1.123 00:E0:81:07:5B:67
s0124 192.168.1.124 00:E0:81:07:F2:83
s0125 192.168.1.125 00:E0:81:03:A0:F8
s0126 192.168.1.126 00:E0:A0:14:0C:07
s0127 192.168.1.127 00:E0:81:03:B2:71
s0129 192.168.1.129 00:E0:81:07:5E:F2
s0130 192.168.1.130 00:E0:81:03:78:AC
s0131 192.168.1.131 00:E0:81:07:E7:35
s0132 192.168.1.132 00:E0:81:03:C5:A8
s0133 192.168.1.133 00:E0:81:08:45:22
s0134 192.168.1.134 00:E0:81:08:71:50
s0135 192.168.1.135 00:E0:81:03:BA:13
s0136 192.168.1.136 00:E0:81:03:CF:E5
s0137 192.168.1.137 00:E0:81:07:85:0F
s0138 192.168.1.138 00:E0:81:03:B9:4C
s0139 192.168.1.139 00:E0:81:03:B8:49
s0140 192.168.1.140 00:E0:81:08:5F:11
s0141 192.168.1.141 00:E0:81:08:69:3F
s0142 192.168.1.142 00:E0:61:06:E8:F1
s0143 192.168.1.143 00:E0:81:03:51:25
s0144 192.168.1.144 00:E0:81:07:A2:65
s0145 192.168.1.145 00:E0:A0:14:2D:77
s0146 192.168.1.146 00:E0:81:07:E0:38
s0147 192.168.1.147 00:E0:81:03:CA:BB
s0149 192.168.1.149 00:E0:81:03:63:94
s0150 192.168.1.150 00:E0:81:07:38:91
STUDENT 192.168.1.254 00:50:8D:4D:A7:A7

[ 本帖最后由 ctrl_119 于 2009-4-10 14:40 编辑 ]

TOP

返回列表