Reputation: 71
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
Upvotes: 0
Views: 2000
Reputation: 380
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.
Upvotes: 4