I'm very new to python.
I wanted to make a Python File (script) that would run cmd
and then run a Command for example: net user
. I tried this
import os
os.system ('start cmd')
but I still need help.
I'm very new to python.
I wanted to make a Python File (script) that would run cmd
and then run a Command for example: net user
. I tried this
import os
os.system ('start cmd')
but I still need help.
You can use subprocess
:
import subprocess
import sys
command = "net user"
subprocess.call(command,shell=True,stdout=sys.stdout)
Example output:
User accounts for \\COMPUTER
-------------------------------------------------------------------------------
user1 user2 user3
The command completed successfully.