[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] 删除交换机DHCP并重建的VBS怎么自动关闭CMD窗口?

写了一个删除交换机DHCP并重建的脚本VBS。运行完后就停在CMD窗口,因为每天要自动运行很多次,时间长了就会有N多的CMD窗口,请问怎么执行自动关闭,现在的代码如下:
  1. set wshshell=createobject("wscript.shell")
  2. wshshell.run "cmd"
  3. wscript.sleep 1000
  4. wshshell.sendkeys "telnet "
  5. wscript.sleep 200
  6. wshshell.sendkeys "192.168.0.1"
  7. wscript.sleep 200
  8. wshshell.sendkeys "{ENTER}"
  9. wscript.sleep 200
  10. wshshell.sendkeys "11111"
  11. wscript.sleep 500
  12. wshshell.sendkeys "{ENTER}"
  13. wshshell.sendkeys "sys"
  14. wscript.sleep 300
  15. wshshell.sendkeys "{ENTER}"
  16. wshshell.sendkeys "undo dhcp server ip-pool 100"
  17. wscript.sleep 300
  18. wshshell.sendkeys "{ENTER}"
  19. wshshell.sendkeys "dhcp server ip-pool 100"
  20. wscript.sleep 300
  21. wshshell.sendkeys "{ENTER}"
  22. wshshell.sendkeys "network 192.168.100.0 mask 255.255.255.0"
  23. wscript.sleep 300
  24. wshshell.sendkeys "{ENTER}"
  25. wshshell.sendkeys "expired day 0 hour 2"
  26. wscript.sleep 300
  27. wshshell.sendkeys "{ENTER}"
复制代码

加几句退出不就行了?

wshshell.sendkeys "exit"
wscript.sleep 300
wshshell.sendkeys "{ENTER}"

TOP

返回列表