Search code examples
pythoncmdconsole

cmd manipulation w/o console.py


Currently this is the closest I've found with assistance; however this allows you to run commands for cmd inside of python which would require the user to know what to do "this is specifically the part I'm trying to code to get around."

I'm trying to get the cmd line commands to run by use of a GUI button using tkinter. And then return what is deemed important from that information in another page that is easily readable for a "user".

For example: the user opens the program. Clicks network and it essentially runs a cmd in the background(the user never sees this actually happen) ipconfig /all stores the network information in a label widgets and they then can easily access the information being displayed.

>>> import subprocess
>>> subprocess.run('cmd', shell=True)

Solution

  • If you don't need cmd itself you can get away using something like:

    subprocess.run("ping::1", shell =True)

    what this does is run the ping::1 (ping your nic) without a user ever seeing a console.