Python无弹窗运行cmd

import sys
sys.setdefaultencoding('utf8')
import os

import subprocess

def main():
    messageBox = "E:/tools/messageBox.exe"
    cmdline = 'cmd.exe /c start /b ' + messageBox + " " + u"标题".encode('utf-8') + " " + u"内容".encode('utf-8')
    subprocess.Popen(cmdline, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)


if __name__ == '__main__':
    sys.exit(main())

你可能感兴趣的:(Python无弹窗运行cmd)