0

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)
Navi Kzc
  • 19
  • 2
  • 8
  • Does this answer your question? [How to execute a program or call a system command?](https://stackoverflow.com/questions/89228/how-to-execute-a-program-or-call-a-system-command) – MercyDude Oct 01 '21 at 15:36
  • @MercyDude I don't know enough about the subprocess to say for sure. I'm going to leave the Question open while I read up and see if I can get it to do what I'm trying for. – Navi Kzc Oct 01 '21 at 16:06
  • @MercyDude it worked but not what I'm expecting to get I may just not know how to manipulate the code to get the expected respones. so I need the ability to run cmd by a GUI clickable button which is where the need for cmd to run without console "in background". with the code: ```>>> import subprocess >>> subprocess.run('cmd', shell=True) ``` it allows me to type into cmd but as far as I can tell I would have to type in the code I want at this point. I need the commands to run in the background so the "user" doesn't see anything but the GUI button they click and the appropriate output. – Navi Kzc Oct 01 '21 at 17:49
  • @KJ I don't want a console to appear because this is supposed to be as "user" friendly as possible it's meant for people who have minimal IT knowledge. Thus if I can remove the console that is less for the user to worry about. – Navi Kzc Oct 01 '21 at 17:59

1 Answers1

0

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.