条件:
1.系统环境变量Path
中包含python
解释器的路径:C:\Python34\python.exe
;
2.python
脚本中添加停止的代码;
新建bat
脚本
@python.exe C:\path\to\your\pythonScripy.py %*
将bat
所在文件夹路径添加到系统路径中
bat
脚本所在的文件夹路径为:C:\MyPythonScripts
;- 将
C:\MyPythonScripts
添加到系统变量Path
的值中;
通过Run
对话框运行批处理脚本
- 输入快捷键
win + R
; - 输入脚本
bat
名称;
Reference
Python
编程快速上手