0

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

Clijsters
  • 4,031
  • 1
  • 27
  • 37
Sravani Chinta
  • 71
  • 2
  • 11

1 Answers1

4

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.

Clijsters
  • 4,031
  • 1
  • 27
  • 37
Chenry Lee
  • 360
  • 2
  • 9