Python 调用Bat 文件
import subprocess
def cmd_test():
pF = subprocess.Popen("cmd.exe /c" + "E:/FTP_Reverse/zhangtong/Bat/1.OneReverse_Down_Ftp.bat", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
curline = pF.stdout.readline()
while (curline != b''):
print(curline)
curline = pF.stdout.readline()
pF.wait()
print(pF.returncode)
p = subprocess.Popen("cmd.exe /c" + "E:/FTP_Reverse/zhangtong/Bat/2.Data_Update.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()
Bat 调用 Python
@echo off
E:
cd E:\FTP_Reverse\zhangtong\Bat
start python Merger_bat.py
exit