bat文件运行一闪而过的解决方法, bat脚本运行py文件失败, 解决.bat文件运行python xx.py一闪而过的问题

bat文件运行一闪而过的解决方法, bat脚本运行py文件失败, 解决.bat文件运行python xx.py一闪而过的问题
bat文件运行一闪而过的解决方法, bat脚本运行py文件失败, 解决.bat文件运行python xx.py一闪而过的问题

 

py示例:

#coding=utf-8
print("hello work")
for i in range(100):
    print(i)

input()
# 或者
# cmd

 

具体原因: 其实程序是运行了,运行完之后就把显示的窗口关掉了 除非你机器运行很卡,不然正常情况下你是看不见任何输出

 

解决方法:

  1. 在程序末尾加“input()”函数(等待输入的函数)
  2. 在bat文件末尾添加cmd (推荐)
  3. 假设你要运行的bat文件为run.bat, 那么你就新建一个start.bat文件,内容为start run.bat
  4. 在bat文件末尾添加pause

 

 

本文:bat文件运行一闪而过的解决方法, bat脚本运行py文件失败, 解决.bat文件运行python xx.py一闪而过的问题

Loading

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.