![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-12 22:29 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Original] Automatic Machine Number and IP Setting Tool 3.0 (Full Version) |
| Printable Version 10,169 / 69 |
| Floor1 qasa | Posted 2007-07-26 17:29 |
| 高级用户 Posts 311 Credits 959 From 广东-LianJiang | |
|
This version was written after continuous improvement and refinement in practice. It corrects previous bugs and possible omissions, and is also a relatively complete version. Thank you for everyone's support and attention. Main code reference: Now attach the source code for everyone to study and give comments. There is also a usage instruction attached. The first post was sent incorrectly, and the 2.0 version was uploaded. It has now been corrected. Those who have already downloaded it please re-download. Thank you. [ Last edited by qasa on 2007-7-26 at 10:03 PM ] Attachments 自动改IP3.0源代码.rar (73.46 KiB) |
|
| Floor2 wudixin96 | Posted 2007-07-26 17:32 |
| 银牌会员 Posts 931 Credits 1,928 | |
|
楼主名字:Zhong Qidong?
So long, headache! |
|
| Floor3 qasa | Posted 2007-07-26 22:08 |
| 高级用户 Posts 311 Credits 959 From 广东-LianJiang | |
Originally posted by wudixin96 at 2007-7-26 17:32: Exactly |
|
| Floor4 ncqingyi | Posted 2007-07-27 09:16 |
| 初级用户 Posts 11 Credits 24 | |
|
I feel that the modification method above is not very rigorous in some places. I specially provide the script I wrote.
@Echo off Title Please waitting. update computer information. set flName=c:\windows\ip.txt set netMask=255.255.255.0 set Gateway=192.168.1.254 set Metric=1 set DNS1=61.177.7.1 set DNS2=221.228.255.1 set DNS3=218.2.135.1 IF EXIST D:\ %windir%\system32\CSCRIPT %windir%\system32\PAGEFILECONFIG.vbs /create /I 768 /M 1536 /VO d: >nul if EXIST E:\ %windir%\system32\CSCRIPT %windir%\system32\PAGEFILECONFIG.vbs /create /I 512 /M 768 /VO E: >nul IF EXIST C:\ %windir%\system32\CSCRIPT %windir%\system32\PAGEFILECONFIG.vbs /change /I 512 /M 768 /VO C: >nul REM GET ComputerName,AdapName,Phyaddr for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find "Host Name"') do set pcName=%%a for /f "tokens=3 delims= " %%a in ('ipconfig /all^|find "Ethernet adapter"') do set AdapName=%%a for /f "tokens=2 delims=:" %%a in ('ipconfig /all^|find "Physical Address"') do set PhyAddr=%%a set pcName=%pcName:~1% set AdapName=%AdapName:~0,-2% set PhyAddr=%PhyAddr:~1% set mac1=%PhyAddr:~0,2% set mac2=%PhyAddr:~3,2% set mac3=%PhyAddr:~6,2% set mac4=%PhyAddr:~9,2% set mac5=%PhyAddr:~12,2% set mac6=%PhyAddr:~15,2% set PhyAddr=%mac1%%mac2%%mac3%%mac4%%mac5%%mac6% set wmicMac=%mac1%:%mac2%:%mac3%:%mac4%:%mac5%:%mac6% :Echo %pcName% %AdapName% %PhyAddr% REM Find ip-Mac addr @ file. for /f "skip=2 tokens=1,2,3,4" %%a in ('find "%PhyAddr%" "%flName%"') do call :findok %%b %%a %%c goto end REM Change Computer name REM :setok @Echo This computer's mac is: %1 ipaddress is: %2 name is: %3 @Echo Please waitting... @Echo Now,update computer name WMIC computersystem where Name="%pcName%" call Rename Name="%3" >nul @Echo Modify ip address WMIC NICCONFIG WHERE MACAddress="%wmicMac%" call EnableStatic("%2"),("%netMask%") >nul WMIC NICCONFIG WHERE MACAddress="%wmicMac%" call SetGateways("%Gateway%") >nul @Echo Modify DNS WMIC NICCONFIG WHERE MACAddress="%wmicMac%" call SetDNSServerSearchOrder("%DNS1%", "%DNS2%", "%DNS3%") >nul :end @Echo All Done! The basic structure of IP.txt: 192.168.1.1 001A928EFC1E PC001 WORKGROUP 192.168.1.2 001A9235D870 PC002 WORKGROUP 192.168.1.3 001A928EF04E PC003 WORKGROUP 192.168.1.4 001A9235B64D PC004 WORKGROUP 192.168.1.5 001A928EF37A PC005 WORKGROUP 192.168.1.6 001A928EF12E PC006 WORKGROUP 192.168.1.7 001A928EE291 PC007 WORKGROUP 192.168.1.8 001A928EE318 PC008 WORKGROUP 192.168.1.9 001A928EF187 PC009 WORKGROUP 192.168.1.10 001A928EF44A PC010 WORKGROUP |
|
| Floor5 ncqingyi | Posted 2007-07-27 09:20 |
| 初级用户 Posts 11 Credits 24 | |
|
All achieved by WMIC to modify computer name, IP address, gateway, DNS server.
Also create Pagefile.sys page files on drives C, D, E respectively, which can prevent formatting. IP.txt is also reused in multiple places. On the DHCP server, use For /f .... do netsh dhcp server *** scope *** add reservedip ip mac to bind MAC to IP, etc. |
|
| Floor6 anson73 | Posted 2007-07-31 21:59 |
| 初级用户 Posts 10 Credits 28 | |
|
Study, study, and keep studying
|
|
| Floor7 Rhinoceros | Posted 2007-08-01 00:22 |
| 新手上路 Posts 9 Credits 18 | |
|
Practical good stuff, thank you to the original poster.
|
|
| Floor8 9393000 | Posted 2007-08-01 19:43 |
| 新手上路 Posts 3 Credits 10 | |
|
Thanks for sharing, let's give it a try.
|
|
| Floor9 gmsx007 | Posted 2007-08-02 03:16 |
| 初级用户 Posts 36 Credits 75 | |
|
Good stuff, can it be smaller?
|
|
| Floor10 smmenglong | Posted 2007-08-09 14:25 |
| 新手上路 Posts 5 Credits 11 | |
|
This one is wanted, but the points are not enough, heh heh
|
|
| Floor11 smmenglong | Posted 2007-08-09 14:26 |
| 新手上路 Posts 5 Credits 11 | |
|
Just reply again and you can download it.
|
|
| Floor12 CZJang | Posted 2007-08-09 14:34 |
| 初级用户 Posts 13 Credits 32 | |
|
How fully automatic is it? Let's download and take a look.
|
|
| Floor13 csyfly2003 | Posted 2007-08-31 18:26 |
| 新手上路 Posts 5 Credits 10 | |
|
Good stuff
|
|
| Floor14 lyaa | Posted 2007-09-03 10:36 |
| 初级用户 Posts 17 Credits 40 | |
|
No money, the owner can send me a copy??lxsky@263.net
|
|
| Floor15 lyaa | Posted 2007-09-05 21:21 |
| 初级用户 Posts 17 Credits 40 | |
| 1 2 3 4 … 5 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |