具体执行代码:
@echo off
"Path where your Python exe is stored\python.exe" "Path where your Python script is stored\script name.py"
▌第一步:
在 CMD 上 输入 where python
,找出python的运行路径
我电脑的output:
C:\Users\Administrator>where python
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe
C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps\python.exe
那么上面的执行代码就填写为:
@echo off
"C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe" "Path where your Python script is stored\script name.py"
▌第二步
填写你的python文件的所在位置
我的文件路径未"C:\Users\bing\Desktop\test.py"
那么上面的执行代码就填写为:
@echo off
"C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe" "C:\Users\bing\Desktop\test.py"
XXX.bat的文件脚本就完成了。
▌第三步
在windows 上执行Task Scheduler创建基本任务:
参考: