python 定制windows 开机启

  • 2020 年 1 月 10 日
  • 筆記

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

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

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

startup.py  ===============================  import os,time,datetime    # what day is it today?    weekday=int(time.strftime("%w"))    #start essentialPIM    os.system('start /b @ping 127.0.0.1 -n 12 -w 1000')    a=os.system('@ping www.baidu.com -n 2 -w 1000')    if a == 0:  os.system('@ping 127.0.0.1 -n 10 -w 1000 > nul')  os.system('start "" "C:Program Files (x86)TencentQQQQProtectBinQQProtect.exe"')    os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')  os.system('start "" "C:UsersAdministratorAppDataLocalGoogleChromeApplicationchrome.exe"')      # start foxmail if is not weekend    if (weekday < 6):  os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')  os.system('start "" "D:softwareRTXCRTX.exe"')  os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')  os.system('start "" "D:Program FilesFoxmail 7.0Foxmail.exe"')  os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')  os.system('start "" "D:softwareEditPlus3EditPlus 3EditPlus.exe"')  os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')  os.system('start "" "D:Program Files (x86)Cisco Systems××× Client***gui.exe"')  os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul')  os.system('start "" "E:masaSecureCRTSecureCRT.exe"')      os.system('exit 0')  ==========================  开机启动win_startup.bat  start /b D:Python26python.exe D:startup.py