最近发现电脑开机速度越来越慢了。准备用python写一个开机启动的小程序:

1:开机后等待12s等待网络连接,之后判断网络,如果还是连接不上,就放弃开机启动的项目。

1:判断开机的日期,如果是周六日的时候就不用开启工作时候的程序了。

  1. startup.py
  2. ===============================
  3. import os,time,datetime
  4. # what day is it today?
  5. weekday=int(time.strftime("%w"))
  6. #start essentialPIM
  7. os.system('start /b @ping 127.0.0.1 -n 12 -w 1000')
  8. a=os.system('@ping www.baidu.com -n 2 -w 1000')
  9. if a == 0:
  10. os.system('@ping 127.0.0.1 -n 10 -w 1000 > nul')
  11. os.system('start "" "C:\Program Files (x86)\Tencent\QQ\QQProtect\Bin\QQProtect.exe"')
  12. os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')
  13. os.system('start "" "C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.exe"')
  14. # start foxmail if is not weekend
  15. if (weekday < 6):
  16. os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')
  17. os.system('start "" "D:\software\RTXC\RTX.exe"')
  18. os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')
  19. os.system('start "" "D:\Program Files\Foxmail 7.0\Foxmail.exe"')
  20. os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')
  21. os.system('start "" "D:\software\EditPlus3\EditPlus 3\EditPlus.exe"')
  22. os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')
  23. os.system('start "" "D:\Program Files (x86)\Cisco Systems\××× Client\***gui.exe"')
  24. os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')
  25. os.system('start "" "E:\masa\SecureCRT\SecureCRT.exe"')
  26. os.system('exit 0')
  27. ==========================
  28. 开机启动win_startup.bat
  29. start /b D:\Python26\python.exe D:\startup.py