0

I am trying to write a python script which will run a run.ps1 PowerShell script. The run.ps1 file is located in different location entirely so I will need to cd into that folder then run the script. In Windows power shell I just need to cd into the file directory then run ./run.ps1. I am trying to simulate that process in Python.

So far I have got:

import subprocess 
subprocess.run("C:/..pathtofile/run.ps1")

This opens up that script in notepad. I want to actually run the script like I would in the terminal.

Jan Wilamowski
  • 3,308
  • 2
  • 10
  • 23
  • 1
    Does this answer your question? [Running PowerShell Script from Python](https://stackoverflow.com/questions/57188398/running-powershell-script-from-python) – Jan Wilamowski Jun 07 '21 at 10:11
  • Note that the accepted answer in the linked duplicate seems like overkill. The other answer should work just as well. https://stackoverflow.com/a/57188501/843953 – Pranav Hosangadi Jun 08 '21 at 16:43

0 Answers0