Board logo

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

作者: hjhssg    时间: 2017-4-19 23:04     标题: 删除交换机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}"
复制代码

作者: 9zhmke    时间: 2017-10-8 15:56

加几句退出不就行了?

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




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2