Thanks for your replies, I guess I solved my problem however I had to use the shell=True parameter otherwise I get the following error:
Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> output = subprocess.run(['dir'], stdout=subprocess.PIPE, text=True) File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 472, in run with Popen(*popenargs, **kwargs) as process: File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "C:\Users\ADMIN\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specifiedThe same behavior when using capture_output=true