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 run those arguments in my python script? So that it mimics the action i am doing in the cmd?
You cannot split a statement into multiple lines in Python by pressing Enter . Instead, use the backslash ( \ ) to indicate that a statement is continued on the next line. In the revised version of the script, a blank space and an underscore indicate that the statement that was started on line 1 is continued on line 2.
You just need to enter /c instead of /k this will open, run and close the command prompt. So this was how to open command prompt using python it was just one line of code you can do automation like creating project folder or installing or running program.
You should use the subprocess module. In particular, subprocess.call will run command line programs for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With