How to Open CMD in the Background With Python

The Windows command prompt (abbreviated as CMD) is used to launch Windows applications and perform system functions. If you are creating a Windows program with Python, you can use Python to call the command prompt and execute a windows command through the command prompt, instead of having to call it through Python (which can be complicated due to Windows restrictions).

Instructions

    • 1

      Open your Python program for editing in your code editor of choice.

    • 2

      Create a new line in the section of the program where you want to open a CMD window by pressing the "Enter" key.

    • 3

      Type (into the new line you just created) the following:

      "py.ext_launch("c:\windows\system32\cmd.exe","arguments");" where "arguments" can either be blank or can be the arguments and applications you want to execute in the command prompt window.

Related Searches:

Comments

Related Ads

Featured