import os import subprocess directory = './' if __name__ == '__main__': cmd = 'D:\IDA_Pro_v6.8\idaq.exe -c -S"raw-feature-extractor/preprocessing_ida.py --path ./store/" ' for filename in os.listdir(directory): if filename[-3:] == 'exe': process = subprocess.Popen(["powershell", cmd+filename], stdout=subprocess.PIPE) output = process.communicate()[0]