pathbreaker

首先中d:/start.bat;详情如下:

start cmd   

编写python文件

#coding=utf-8
import subprocess

def cmd_test():
    # cmd = \'cmd.exe d:/start.bat\'
    p = subprocess.Popen("cmd.exe /c" + "d:/start.bat", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    curline = p.stdout.readline()
    while (curline != b\'\'):
        print(curline)
        curline = p.stdout.readline()
    p.wait()
    print(p.returncode)

if __name__ == \'__main__\':
    cmd_test()

执行时可以打开cmd窗口;丰富.bat文件可以达到意想不到的效果,如:monkey命令的自动执行

参考:https://www.jianshu.com/p/430c411160f8

分类:

技术点:

相关文章:

  • 2021-12-04
  • 2022-01-02
  • 2021-11-06
  • 2021-11-06
  • 2021-11-06
  • 2021-11-11
  • 2021-11-15
  • 2021-10-17
猜你喜欢
  • 2021-11-06
  • 2021-11-06
  • 2021-08-04
  • 2021-10-03
  • 2021-12-15
  • 2021-08-07
  • 2021-12-15
相关资源
相似解决方案