中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 求助!不知道哪地方写的不对了,运行出错!~
作者:
标题: 求助!不知道哪地方写的不对了,运行出错!~ 上一主题 | 下一主题
821230
初级用户

新兵连


积分 25
发帖 9
注册 2007-10-17
状态 离线
『楼 主』:  求助!不知道哪地方写的不对了,运行出错!~

@color c
@cls            :::清屏
@echo [Name][network]  [IP]        [CDKey]   >config.cfg
@echo  pc001  001  192.168.123.1  2091322607845 >>config.cfg
@echo  pc002  002  192.168.123.2  2298968563104 >>config.cfg
@echo  pc003  003  192.168.123.3  2293620604801 >>config.cfg
@echo  pc004  004  192.168.123.4  3199547101847 >>config.cfg
@echo  pc005  005  192.168.123.5  2395626620868 >>config.cfg
@echo  pc006  006  192.168.123.6  2291425624864 >>config.cfg
@echo  pc007  007  192.168.123.7  2297324646860 >>config.cfg
@echo  pc008  008  192.168.123.8  5692438065881 >>config.cfg
@echo  pc009  009  192.168.123.9  2399929424868 >>config.cfg
@echo  pc010  010  192.168.123.10  3198647142822 >>config.cfg
@echo  pc011  011  192.168.123.11  3290343195800 >>config.cfg
@echo  pc012  012  192.168.123.12  5791532078882 >>config.cfg
@echo  pc013  013  192.168.123.13  3192341122881 >>config.cfg
@echo  pc014  014  192.168.123.14  3296148120849 >>config.cfg
@echo  pc015  015  192.168.123.15  2398829402826 >>config.cfg
@echo  pc016  016  192.168.123.16  3397646195802 >>config.cfg
@echo  pc017  017  192.168.123.17  3799865089843 >>config.cfg
@echo  pc018  018  192.168.123.18  3291644192804 >>config.cfg
@echo  pc019  019  192.168.123.19  3395445159841 >>config.cfg
@echo  pc020  020  192.168.123.20  5596230082889 >>config.cfg
@echo  pc021  021  192.168.123.21  2393026614856 >>config.cfg
@echo  pc022  022  192.168.123.22  7282726715071 >>config.cfg
@echo  pc023  023  192.168.123.23  6965198320844 >>config.cfg
@echo  pc024  024  192.168.123.24  0590638349985 >>config.cfg
@echo  pc025  025  192.168.123.25  4887920308855 >>config.cfg
@echo  pc026  026  192.168.123.26  6224273676938 >>config.cfg
@echo  pc027  027  192.168.123.27  0234070701672 >>config.cfg
@echo  pc028  028  192.168.123.28  6829133462999 >>config.cfg
@echo  pc029  029  192.168.123.29  1514397024359 >>config.cfg
@echo  pc030  030  192.168.123.30  0338114504295 >>config.cfg
@echo  pc031  031  192.168.123.31  9180097837863 >>config.cfg
@echo  pc032  032  192.168.123.32  5695926015450 >>config.cfg
@echo  pc033  033  192.168.123.33  3160620118964 >>config.cfg
@echo  pc034  034  192.168.123.34  1190096475687 >>config.cfg
@echo  pc035  035  192.168.123.35  8359933291311 >>config.cfg
@echo  pc036  036  192.168.123.36  2696985056117 >>config.cfg
@echo  pc037  037  192.168.123.37  7853809758364 >>config.cfg
@echo  pc038  038  192.168.123.38  2111724559521 >>config.cfg
@echo  pc039  039  192.168.123.39  0578332166402 >>config.cfg
@echo  pc040  040  192.168.123.40  5735257958665 >>config.cfg
@echo  pc041  041  192.168.123.41  7914860615387 >>config.cfg
@echo  pc042  042  192.168.123.42  4063606421917 >>config.cfg
@echo  pc043  043  192.168.123.43  3419830076512 >>config.cfg
@echo  pc044  044  192.168.123.44  7381489152175 >>config.cfg
@echo  pc045  045  192.168.123.45  1628431817077 >>config.cfg
@echo  pc046  046  192.168.123.46  2876552803407 >>config.cfg
@echo  pc047  047  192.168.123.47  8856983770314 >>config.cfg
@echo  pc048  048  192.168.123.48  7530358675181 >>config.cfg
@echo  pc049  049  192.168.123.49  5174560117316 >>config.cfg
@echo  pc050  050  192.168.123.50  7322581102730 >>config.cfg
@echo  pc051  051  192.168.123.51  0719965552707 >>config.cfg
@echo  pc052  052  192.168.123.52  5620798081913 >>config.cfg
@echo  pc053  053  192.168.123.53  3185381184427 >>config.cfg
@echo  pc054  054  192.168.123.54  8680457335754 >>config.cfg
@echo  pc055  055  192.168.123.55  9869960983369 >>config.cfg
@echo  pc056  056  192.168.123.56  6915151587317 >>config.cfg
@echo  pc057  057  192.168.123.57  1272066388570 >>config.cfg
@echo  pc058  058  192.168.123.58  9301433546382 >>config.cfg
@echo  pc059  059  192.168.123.59  5817471724979 >>config.cfg
@echo  pc060  060  192.168.123.60  7946642797514 >>config.cfg
@echo  pc061  061  192.168.123.61  3926072554435 >>config.cfg
@echo  pc062  062  192.168.123.62  9956746016428 >>config.cfg
@echo  pc063  063  192.168.123.63  0590651353471 >>config.cfg
@echo  pc064  064  192.168.123.64  1714170985947 >>config.cfg
@echo  pc065  065  192.168.123.65  5499802054656 >>config.cfg
@echo  pc066  066  192.168.123.66  1163480853697 >>config.cfg
@echo  pc067  067  192.168.123.67  3739923265822 >>config.cfg
@echo  pc068  068  192.168.123.68  3354655249230 >>config.cfg
@echo  pc069  069  192.168.123.69  1204514178341 >>config.cfg
@echo  pc070  070  192.168.123.70  8144711732971 >>config.cfg
@echo  pc071  071  192.168.123.71  8451579776433 >>config.cfg
@echo  pc072  072  192.168.123.72  8206536922064 >>config.cfg
@echo  pc073  073  192.168.123.73  7267404852062 >>config.cfg
@echo  pc074  074  192.168.123.74  6365487067597 >>config.cfg
@echo  pc075  075  192.168.123.75  4919689608720 >>config.cfg
@echo  pc076  076  192.168.123.76  2960547428824 >>config.cfg
@echo  pc077  077  192.168.123.77  0504759069059 >>config.cfg
@echo  pc078  078  192.168.123.78  3050776320471 >>config.cfg
@echo  pc079  079  192.168.123.79  0694888961606 >>config.cfg
@echo  pc080  080  192.168.123.80  9655746791606 >>config.cfg
@echo  pc081  081  192.168.123.81  9610972107773 >>config.cfg
@echo  pc082  082  192.168.123.82  7937556243769 >>config.cfg
@echo  pc083  083  192.168.123.83  5898414073778 >>config.cfg
@echo  pc084  084  192.168.123.84  8334441434100 >>config.cfg
@echo  pc085  085  192.168.123.85  5988643975322 >>config.cfg
@echo  pc086  086  192.168.123.86  3522855506549 >>config.cfg
@echo  pc087  087  192.168.123.87  2721837712087 >>config.cfg
@echo  pc088  088  192.168.123.88  0375939353208 >>config.cfg
@echo  pc089  089  192.168.123.89  8326908182312 >>config.cfg
@echo  pc090  090  192.168.123.90  0058411868073 >>config.cfg
@echo  pc091  091  192.168.123.91  7386866002317 >>config.cfg
@echo  pc092  092  192.168.123.92  9415036075966 >>config.cfg
@cls            :::清屏
@echo  ╔┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╗
@echo  ┋                                                                        ┋
@echo  ┋            独来读网自动改IP,计算机名,CS CDKEY,内部网络号批处理         ┋
@echo  ┋                                                                        ┋
@echo  ╚┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╝
@echo off
@echo ---------------------------------------------------
@set/p 机号= 请输入计算机号:
@echo ---------------------------------------------------
::::获取机器的TCP/IP 配置
@if exist ipconfig.txt  del ipconfig.txt   
@ipconfig /all >ipconfig.txt

:::分离出机器的物理地址,并保存到 ( mac.txt) 文件中
@if exist phyaddr.txt   del phyaddr.txt
@find  "Physical Address" ipconfig.txt >c:\%机号%mac.txt

:::分离出机器的Cdkey,并保存到 ( Cdkey.txt) 文件中
@find  "%机号%" config.cfg >Cdkey.txt

::::从(Cdkey.txt)文件中取Cdkey字符串,并赋给变量strCdkey
@for /f "skip=1 tokens=4" %%C in (Cdkey.txt) do set strCdkey=%%C

:::显示Cdkey
@echo %strCdkey% >nul

::::从(Cdkey.txt)文件中取IP字符串,并赋给变量
@for /f "skip=1 tokens=3" %%N in (Cdkey.txt) do set myip=%%N

:::显示ip
@echo 更改IP为:%myip%

::::从(Cdkey.txt)文件中取网络号字符串,并赋给变量
@for /f "skip=1 tokens=2" %%M in (Cdkey.txt) do set netkey=%%M

:::显示ip
@echo 更改IP为:%netkey%

@echo Windows Registry Editor Version 5.00 >计算机名.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName] >>计算机名.reg

::::用变量""去替换实际的机器名  
@echo "ComputerName"="%机号%"  >>计算机名.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >>计算机名.reg

::::用变量"机号"去替换实际的机器名
@echo "NV Hostname"="%机号%"  >>计算机名.reg
@echo "Hostname"="%机号%"  >>计算机名.reg


::::修改 CS-CDKEY 不用管它
@echo [HKEY_CURRENT_USER\Software\Valve\CounterStrike\Settings] >>计算机名.reg
@echo "Key"="%strCdkey%">>计算机名.reg


::::创建注册表文件内部网络编号
@echo Windows Registry Editor Version 5.00 >内部网络编号.reg

::::用变量"%机号%"去替换实内部网络编号
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] >>内部网络编号.reg
@echo "VirtualNetworkNumber"=dword:00000%netkey% >>内部网络编号.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NwlnkIpx\Parameters] >>内部网络编号.reg
@echo "VirtualNetworkNumber"=dword:00000%netkey% >>内部网络编号.reg

::::导入注册表文件。
@regedit /s 计算机名.reg
@regedit /s 内部网络编号.reg

::::修改IP 地址。用变量"%myip%" 去替换实际的IP 地址
@netsh interface ip set address name="本地连接" source=static addr=%myip% mask=255.255.255.0 gateway=192.168.123.254 gwmetric=1

pause



·!###小子太帅!·##
2007-10-21 13:54
查看资料  发短消息 网志   编辑帖子  回复  引用回复
world615
初级用户





积分 24
发帖 9
注册 2007-8-1
状态 离线
『第 2 楼』:  

建议开头用@echo off
要看执行过程就echo on,便于查找错误。

2007-10-21 14:26
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
lxmxn
版主




积分 11386
发帖 4938
注册 2006-7-23
状态 离线
『第 3 楼』:  

哪儿错了呢?说清楚嘛

2007-10-21 23:13
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: