批处理文件,在XP系统中的运行问题

deweyfbi 2006-07-17 10:36:25

自己对批处理文件不是很熟悉,
因为需要做了一个小的批处理文件如下:

[arp.bat文件名]
@echo on
arp -d
arp -s 222.20.44.254 00-D0-F8-FE-4B-95
pause
exit

但是,在双击后,看到的是cmd中不断出现的如下问题:
C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

C:\Documents and Settings\Dewey\桌面>arp -d

一直这样重复,就是执行不了,怎么回事?
我系统是 Microsoft Windows XP Professional
Service Pack 2,v.2096
在同学电脑上也不能执行,
...全文
98 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
liubingqian 2006-07-19
  • 打赏
  • 举报
回复
因为若省略扩展名,则按照com exe bat扩展名的顺序先在当前目录中找,若没找到则到path路径中找。若找到则执行,恰好你的当前目录中有名为arp.bat的文件(找到的就是你的批处理文件本身),你的批处理又找到了该文件本身,这样没有终止成了死循环。
liubingqian 2006-07-19
  • 打赏
  • 举报
回复
你本意是想在批处理文件中执行C:\WINDOWS\system32\arp.exe这个文件,但效果确是执行了批处理文件本身,因为它们的主文件名都是arp,并且都是可执行的。
把批处理文件换个主文件名,或者在批处理中写上完整的文件名arp.exe
deweyfbi 2006-07-19
  • 打赏
  • 举报
回复
海风,太感谢了,没想到是这个错误!
deweyfbi 2006-07-18
  • 打赏
  • 举报
回复
arp -d *
arp -s 222.20.44.254 00-D0-F8-FE-4B-95
pause


把上面三行我复制到记事本中,另存为arp.bat,按照这个我试了,但是结果是
C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *

C:\Documents and Settings\Dewey\桌面>arp -d *


依然没有达到我需要的效果!
该怎样解决呀??
nevsong 2006-07-18
  • 打赏
  • 举报
回复
[arp.bat文件名]
arp -d *
arp -s 222.20.44.254 00-D0-F8-FE-4B-95
pause

默认就是@echo on 所以可以省略,exit也不用

3,426

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 其他开发语言
社区管理员
  • 其他开发语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧