-1

Currently, I am running an exe file (test.exe) by Powershell. It requires an input file's name as an argument. It means, I have to type ./test.exe input.txt in Powershell command in order to run the file in powershell.

And now I want to automate this stuff by Python, but I couldn't found a clear way to do this. As far as I figured out is that import subprocess and blah-blah is necessary but I am not that good into coding so can anybody tell me to make it?

'test.exe' file is located in C:\Users\KIM\Desktop\TEST and Powershell is located in C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Santosh Aryal
  • 1,276
  • 1
  • 18
  • 41

1 Answers1

0

You can use this:

import subprocess
subprocess.call(['C:\Windows\System32\WindowsPowershell\v1.0\Powershell.exe', 'C:\Users\KIM\Desktop\Test\Test.exe', 'input.txt']) 
Wasif
  • 14,755
  • 3
  • 14
  • 34