最近发现电脑开机速度越来越慢了。准备用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)\Tencent\QQ\QQProtect\Bin\QQProtect.exe"') os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul') os.system('start "" "C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chrome.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:\software\RTXC\RTX.exe"') os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul') os.system('start "" "D:\Program Files\Foxmail 7.0\Foxmail.exe"') os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul') os.system('start "" "D:\software\EditPlus3\EditPlus 3\EditPlus.exe"') os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul') os.system('start "" "D:\Program Files (x86)\Cisco Systems\××× Client\Vpngui.exe"') os.system('@ping 127.0.0.1 -n 3 -w 1000 > nul') os.system('start "" "E:\masa\SecureCRT\SecureCRT.exe"') os.system('exit 0') ========================== 开机启动win_startup.bat start /b D:\Python26\python.exe D:\startup.py