I have this PowerShell script and I have manually executed this
powershell -Command "C:\shellcommand.ps1"
I am writing it as subprocess.check_output("powershell -Command 'C:\\shellcommand.ps1'")
I am getting result as C:\\\\shellcommand.ps1\\r\\n
. Actually I am trying to run a batch file from the script. Manually it is running.
Could you please help me how I can able to call this in python
Parameter -Command
is for cmdlets, and -File
is for scripts.
Try This:
powershell -ExecutionPolicy ByPass -File"C:\shellcommand.ps1"
I think it will work for you.
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.