Board logo

标题: [系统相关] [已解决]下面这个自动判断时间自动关机的bat代码。应该如何精简下?谢谢 [打印本页]

作者: ygqiang    时间: 2014-11-25 18:52     标题: [已解决]下面这个自动判断时间自动关机的bat代码。应该如何精简下?谢谢

本帖最后由 ygqiang 于 2014-11-26 23:59 编辑

[已解决]下面这个自动判断时间自动关机的bat代码。应该如何精简下?谢谢
  1. at 12:15 taskkill /f /im 软件xx.EXE
  2. at 12:15 taskkill /f /im AutoRedrCard.exe
  3. ping 127.0.0.1 -n 2 >nul 2>nul
  4. at 12:15 shutdown -s -f -t 2
  5. at 12:16 taskkill /f /im 软件xx.EXE
  6. at 12:16 taskkill /f /im AutoRedrCard.exe
  7. ping 127.0.0.1 -n 2 >nul 2>nul
  8. at 12:16 shutdown -s -f -t 2
  9. at 12:17 taskkill /f /im 软件xx.EXE
  10. at 12:17 taskkill /f /im AutoRedrCard.exe
  11. ping 127.0.0.1 -n 2 >nul 2>nul
  12. at 12:17 shutdown -s -f -t 2
  13. at 12:18 taskkill /f /im 软件xx.EXE
  14. at 12:18 taskkill /f /im AutoRedrCard.exe
  15. ping 127.0.0.1 -n 2 >nul 2>nul
  16. at 12:18 shutdown -s -f -t 2
  17. at 12:19 taskkill /f /im 软件xx.EXE
  18. at 12:19 taskkill /f /im AutoRedrCard.exe
  19. ping 127.0.0.1 -n 2 >nul 2>nul
  20. at 12:19 shutdown -s -f -t 2
  21. at 21:50 taskkill /f /im 软件xx.EXE
  22. at 21:50 taskkill /f /im AutoRedrCard.exe
  23. ping 127.0.0.1 -n 2 >nul 2>nul
  24. at 21:50 shutdown -s -f -t 2
  25. at 21:51 taskkill /f /im 软件xx.EXE
  26. at 21:51 taskkill /f /im AutoRedrCard.exe
  27. ping 127.0.0.1 -n 2 >nul 2>nul
  28. at 21:51 shutdown -s -f -t 2
  29. at 21:52 taskkill /f /im 软件xx.EXE
  30. at 21:52 taskkill /f /im AutoRedrCard.exe
  31. ping 127.0.0.1 -n 2 >nul 2>nul
  32. at 21:52 shutdown -s -f -t 2
  33. at 21:53 taskkill /f /im 软件xx.EXE
  34. at 21:53 taskkill /f /im AutoRedrCard.exe
  35. ping 127.0.0.1 -n 2 >nul 2>nul
  36. at 21:53 shutdown -s -f -t 2
  37. at 21:54 taskkill /f /im 软件xx.EXE
  38. at 21:54 taskkill /f /im AutoRedrCard.exe
  39. ping 127.0.0.1 -n 2 >nul 2>nul
  40. at 21:54 shutdown -s -f -t 2
复制代码

作者: CrLf    时间: 2014-11-25 19:16

  1. SCHTASKS /Create /SC MINUTE /TN doc /TR a.bat
复制代码

作者: ygqiang    时间: 2014-11-25 19:22

回复 2# CrLf
  1. @echo off
  2. if "%1" == "h" goto begin
  3. mshta vbscript:createobject("wscript.shell").run("%~fs0 h",0)(window.close)&&exit
  4. :begin
  5. rem 下边开始写批处代码了
  6. ping 127.0.0.1 -n 30 >nul 2>nul
  7. sc config schedule start= demand
  8. net start schedule
  9. ——————————————————————————————————————————————————————
  10. :first2
  11. at 21:50 taskkill /f /im 软件xx.EXE
  12. at 21:50 taskkill /f /im AutoRedrCard.exe
  13. ping 127.0.0.1 -n 2 >nul 2>nul
  14. at 21:50 shutdown -s -f -t 2
  15. at 21:51 taskkill /f /im 软件xx.EXE
  16. at 21:51 taskkill /f /im AutoRedrCard.exe
  17. ping 127.0.0.1 -n 2 >nul 2>nul
  18. at 21:51 shutdown -s -f -t 2
  19. at 21:52 taskkill /f /im 软件xx.EXE
  20. at 21:52 taskkill /f /im AutoRedrCard.exe
  21. ping 127.0.0.1 -n 2 >nul 2>nul
  22. at 21:52 shutdown -s -f -t 2
  23. at 21:53 taskkill /f /im 软件xx.EXE
  24. at 21:53 taskkill /f /im AutoRedrCard.exe
  25. ping 127.0.0.1 -n 2 >nul 2>nul
  26. at 21:53 shutdown -s -f -t 2
  27. at 21:54 taskkill /f /im 软件xx.EXE
  28. at 21:54 taskkill /f /im AutoRedrCard.exe
  29. ping 127.0.0.1 -n 2 >nul 2>nul
  30. at 21:54 shutdown -s -f -t 2
  31. ping 127.0.0.1 -n 20 >nul 2>nul
  32. goto first2
复制代码
多谢。


开机,就循环运行这个bat代码!
为啥有时关机不了呢?屏幕上只有鼠标指针能动,桌面啥的都没有了。

就是想实现:自动判断时间自动关机
作者: CrLf    时间: 2014-11-25 21:20

  1. SCHTASKS /Create /SC MINUTE /mo 1 /ST 12:15 /ET 21:54 /TN hahaha /TR c:\a.bat
复制代码
c:\a.bat:
  1. taskkill /f /im 软件xx.EXE
  2. taskkill /f /im AutoRedrCard.exe
  3. ping 127.0.0.1 -n 2 >nul 2>nul
  4. shutdown -s -f -t 2
复制代码

作者: ygqiang    时间: 2014-11-27 00:23

已解决。
http://bathome.net/thread-33071-1-1.html




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