本帖最后由 zhanghdong 于 2011-4-11 20:22 编辑
帮忙把此代码改成win7 x64可用的代码- @echo off
- set MASK=255.255.255.0
- set GATEWAY=192.168.1.1
- set DNS=192.11.22.33
- for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%i
- for /f "tokens=1,2*" %%i in ('ipconfig /all^|find "Ethernet adapter"') do set Ethernet=%%k
- for /f "tokens=1,2" %%i in ('more /e +13 %0 ^|find /i "%mac:~,-1%"') do set "name=%%i"&set "IP=%%j"
- 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
- A010 192.168.1.2 62-64-65-66-87-76
- A011 192.168.0.101 00-1A-4D-9C-82-87
- A012 192.168.0.102 00-E0-A0-0E-DC-8C
复制代码
|