服务对象:
1.Windows系统
2.台式机
3.电池没电,又懒得换
工具下载链接:
实现解析:
1.语言:Python
2.模块:requests、subprocess
3.利用Python,我们实现了快速开发的“目的”
4.同时,避免了bat脚本修改注册表的风险(详情:点我前往)
代码开源:
(可根据自身需求进行二次开发)
import requests import subprocess # 从网络获取时间 response = requests.get("http://quan.suning.com/getSysTime.do") data = response.json()['sysTime2'] date, time = data.split(" ") cmd1 = f"date {date}" cmd2 = f"time {time}" # 使用run方法执行命令,并设置shell=True以在命令行中执行命令 result1 = subprocess.run(cmd1, shell=True, capture_output=True) result2 = subprocess.run(cmd2, shell=True, capture_output=True)
Windows系统-台式机-电池没电-自动同步时间工具
于 2023-09-29 20:32:20 首次发布