Running Command Lines Within Your Python Script
So I have a bunch of aliases and Command Line prompt programs, and my main program works by inputting b into the cmd.exe, followed by some filepath names and what not. How would I
Solution 1:
You should use the subprocess module. In particular, subprocess.call will run command line programs for you.
Solution 2:
or you can use
import osos.system('your_command')
for example:
import osos.system('notepad')
will launch the notepad with the command line behind.
hope this helps
Solution 3:
You can do this using subprocess
For example, this call bellow gets the output of the program and stores it as a string, using .call
will help with calling it and for more accurate control use .Popen
subprocess.check_output(["ipconfig"])
Post a Comment for "Running Command Lines Within Your Python Script"