I am running a Python script in my laptop(windows 64 bit) but I want to invoke a windows powershell script to perform some task. This *.ps1 file should be invoked whenever I run this Python script on my windows laptop. Any ideas how do i do that? or what is the command to Invoke *.ps1 from a python script?
You can open a subprocess
import subprocess
subprocess.Popen('powershell.exe [your command]')
or use the os module
import os
os.system('powershell.exe [your command]')
The powershell process has several command line arguments, documented here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.