H
H
Hacker Hackers2021-08-05 04:21:44
Python
Hacker Hackers, 2021-08-05 04:21:44

How to execute cmd command through python?

I want to run a command from the command line only do it with python code

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Agagulov, 2021-08-05
@XaKeP31

import os
os.system('command')
ex:
os.system('color C4')

S
Swartex, 2021-08-05
@Swartex

best is to use
subprocess.run
https://hackernoon.com/calling-shell-commands-from...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question