Python Forum

Full Version: os.system("netsh interface set interface 'Wi-Fi' enabled")
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Jan-17-2019, 07:00 PM)nilamo Wrote: [ -> ]What happens if you run it with admin privileges, as it suggests?
The output is this without error and without doing anything. it doesn't do anything at all.
Output:
Process finished with exit code 0
Are you sure it didn't do anything? If it succeeds, netsh doesn't have any output, and an exit code of zero means success. For me, when I ran that, there was no output, but my wifi adapter had been disabled.
(Jan-17-2019, 10:31 PM)nilamo Wrote: [ -> ]Are you sure it didn't do anything? If it succeeds, netsh doesn't have any output, and an exit code of zero means success. For me, when I ran that, there was no output, but my wifi adapter had been disabled.

IT is Working now. Thanks
import os
import subprocess
os.system("netsh interface show interface")
# It will enabled Wi-Fi Network
subprocess.call(['netsh', 'interface', 'set', 'interface', 'Wi-Fi', 'enabled'])
Output:
Admin State State Type Interface Name ------------------------------------------------------------------------- Disabled Disconnected Dedicated Wi-Fi Disabled Disconnected Dedicated TPALAN Process finished with exit code 0
Working Perfectly. Thank you
Pages: 1 2