Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用Python自动化.exe程序_Python_Subprocess_Exe - Fatal编程技术网

用Python自动化.exe程序

用Python自动化.exe程序,python,subprocess,exe,Python,Subprocess,Exe,我有一个.exe程序,正在将AGS文件转换为Excel文件。 我有很多文件要转换,所以我想知道我能用Python自动转换吗?转换程序只需要两个位置,一个用于输入,一个用于输出,见图 对于Python,我很乐意使用以下代码启动程序,但是否可以传递2个路径并单击导出 import subprocess path = r'C:\Program Files (x86)\AGSToExcel.exe' #Start the programs subprocess.call([path]) #other

我有一个.exe程序,正在将AGS文件转换为Excel文件。 我有很多文件要转换,所以我想知道我能用Python自动转换吗?转换程序只需要两个位置,一个用于输入,一个用于输出,见图

对于Python,我很乐意使用以下代码启动程序,但是否可以传递2个路径并单击导出

import subprocess
path = r'C:\Program Files (x86)\AGSToExcel.exe'

#Start the programs
subprocess.call([path])

#other locations
path_ags = r'C:\Users\X\Documents\AGS_file1.ags'
path_excel = r'C:\Users\X\Documents\Book1.xls'

我对包子流程相当陌生,所以我不知道这是否可行

如果需要,您可能可以使用pyautogui单击并键入。 你可以在这里看到一个简单的例子


PyAutoGUI将非常适合这一点。您必须定义一种以编程方式生成excel文件名的方法,这样您就不会覆盖任何内容,并确保您的文件系统是有组织的,这样您就可以简单地循环转换过程中目录中的所有项目。谢谢,这帮了大忙。我使用os.listdir和pyautogui.typewrite列出文件夹中的所有文件,循环遍历所有文件并在程序中键入路径。